Why would you want to serialize (b)

Java object is the transmission through the network. Then the sequence of networks are required manner so that transformation by java object of bytes transferred bytes, then the receiving end of the other end of the network, then the received bytes to get out of an object to deserialize, for ensuring java objects can cross-process transfer.

Summed up serialization points: 1. In the java, as long as a class implements java.io.Serializable interface, then it can be serialized sequence of compound 2. deserialize objects by ObjectOutputStream and ObjectInputStream 3. whether to allow the object to be deserialized, just depending on whether the object code is the same, as well as an important factor (UID) 4. sequence of static variables are not saved 5. to be involved in the parent object serialization operation, we must let the parent class also implements the serializable interface 6. Transient keyword, primarily whether the control variable can be serialized. If the sequence is not a member of the variable deserialized, is set to an initial value, such as String -> null depth is achieved by clone 7. The operation sequence

Serialization techniques are the mainstream: JSON / Hessian (2) / xml / protobuf / kryo / MsgPack / FST / thrift / protostuff / Avro

Which it is commonly used, but the best performance is JSON of jprotobuf Baidu Baidu Google's protobuf is encapsulated. dubbo using Hessian2 serialized byte large but fast jprotobuf serialization point slightly slower speed, but little bytes.

This is the choice of two different sequences of technical reason.

Guess you like

Origin www.cnblogs.com/zhimingxin/p/11227378.html