Is it possible to use struct-like constructs in Java?

前端 未结 8 1967
时光取名叫无心
时光取名叫无心 2020-12-30 11:15

I\'m considering using Java for a large project but I haven\'t been able to find anything that remotely represented structures in Java. I need to be able to convert network

8条回答
  •  再見小時候
    2020-12-30 12:13

    You cannot cast array of bytes to instance of class. But you can do much much more with java. Java has internal, very strong and very flexible mechanism of serialization. This is what you need. You can read and write object to/from stream.

    If both sides are written in java, there are no problem at all. If one of sides is not java you can customeze your serialization. Start from reading javadoc of java.util.Serializable.

提交回复
热议问题