Use String or Object for data in Java NIO-based distributed system? [closed]
I am trying to send data different data (Security keys, encrypted message )in distributed system that use Java NIO. my 开发者_JAVA技巧question is what is the best way to send data? . I am currently sending data using base64 encoding and append different data in to a single string. Is this good or it will be good to send data using java serializable object.
please help Thanx
I would probably avoid using Strings and Java default serialization - that's likely to be pretty inefficient and give you a lot of overhead.
I'd recommend looking at a library like Kryonet or Netty instead.
Alternatively you can create your own serialisation code using NIO, but that's quite complex to get right and a lot of work....
精彩评论