Java serialized and non serialized objects

1) Can non serialized Java objects be sent over the network for execution by another JVM or stored in a local file store to recover data?

Solution

Serialization is a method of representing Java objects as a series of bytes It's just a format

Serialization / deserialization itself has nothing to do with "sending over the network" It's just convenient to send a binary stream, which can be created from an object with serialization

What's more, sometimes built-in serialization is not the best way to get binary streams, because sometimes fewer bytes can be used to convert objects

Therefore, you can use a custom protocol to provide your own customization for serialization (for example, externalizable)

Even use third-party libraries like Apache Avro

I think this effectively answers your two questions:

>If necessary, you can convert the non serialized object (I guess the object that does not implement the "serializable" interface) into a byte sequence (byte stream), and then send it over the network and store it in a binary file, anyway Of course, you must know how to read this binary format for conversion. > Since serialization is only a conversion protocol rather than "storing related things", the answer is obvious

I hope this will help

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>