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

前端 未结 8 1931
时光取名叫无心
时光取名叫无心 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:20
    ByteBuffer.wrap(new byte[] {}).getDouble();
    
    0 讨论(0)
  • 2020-12-30 12:21

    There is nothing which matches your description.

    The closest thing to a struct in Java is a simple class which holds values either accessible through it's fields or set/get methods.

    The typical means to convert between Java class instances and on-the-wire representations is Java serialization which can be heavily customized as need be. It is what is used by Java's Remote Method Invocation API and works extremely well.

    0 讨论(0)
提交回复
热议问题