IO; using System. Serialization; using Castle. Serialize memoryStream, this ; memoryStream. Seek 0, SeekOrigin. Begin ; return new StreamReader memoryStream. OpenOrCreate, FileAccess. Join "", text. IsControl c ; base. Open, FileAccess. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. Serialization is the process of converting an object into a stream of bytes to store the object or transmit it to memory, a database, or a file.
Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization. The object is serialized to a stream that carries the data. The stream may also have information about the object's type, such as its version, culture, and assembly name. From that stream, the object can be stored in a database, a file, or memory. Serialization allows the developer to save the state of an object and re-create it as needed, providing storage of objects as well as data exchange.
Through serialization, a developer can perform actions such as:. The System. JSON is an open standard that is commonly used for sharing data across the web. To control the way JsonSerializer serializes or deserializes an instance of the class:. Serialization namespace contains classes for binary and XML serialization and deserialization. ObjectOutputStream can be extended to customize the information about classes in the stream or to replace objects to be serialized.
Refer to the annotateClass and replaceObject method descriptions for details. The readObject method deserializes the next object in the stream and traverses its references to other objects recursively to create the complete graph of objects serialized.
Individual bytes and arrays of bytes are read with the methods of InputStream. Except for serializable fields, primitive data is read from block-data records. ObjectInputStream can be extended to utilize customized information in the stream about classes or to replace objects that have been deserialized.
Refer to the resolveClass and resolveObject method descriptions for details. Each object that acts as a container implements an interface which allows primitives and objects to be stored in or retrieved from it. These interfaces are the ObjectOutput and ObjectInput interfaces which:. To be stored in an Object Stream, each object must implement either the Serializable or the Externalizable interface:. When a class is declared Serializable, the serializable state of the object is defined by serializable fields by name and type plus optional data.
Optional data can only be written explicitly by the writeObject method of a Serializable class. Next Topic Transient Keyword in java. Reinforcement Learning.
R Programming. React Native. Python Design Patterns. Python Pillow. Python Turtle. Verbal Ability. Interview Questions. Company Questions. Artificial Intelligence. Cloud Computing. Data Science. Angular 7.
Machine Learning. Data Structures. Operating System. Computer Network. Compiler Design.
0コメント