flow

Streams are divided into two types according to the direction: input stream and output stream. The memory is used as the reference. When the data is read from the data source into the memory, it is called the input stream, also called the read stream. When the data in the memory is read When writing to a data source, it is called an output stream, also called a write stream.

Streams are divided into byte streams, character streams, and object streams according to the content of the transmission. No matter the underlying part of the stream is transmitted in bytes, it is essentially a byte stream, but in order to facilitate programmers to better operate character data and object data, so on the basis of the byte stream. A layer of packaging that forms a character stream and an object stream

The parent class of byte stream is InputStream and OutputStream
The parent class of character stream is Reader and Writer

Step
1 of stream operation, create stream
2, operate stream
3, close stream
When operating a file stream, if the file does not exist, a file not found exception will be thrown when reading the stream, and a new file will be created when writing to the stream

After the stream operation is completed, the stream operation must be closed, otherwise it will not only waste memory resources, but also the writing stream may not be able to write data.

Serialization: When the object needs to be transmitted, because the data in the object is too large and cannot be transmitted directly, the object needs to be broken up into a binary sequence for transmission before transmission. This process is called the serialization process. After the destination, it is necessary to restore the binary sequence to an object. This process is called the deserialization process.

All objects that need to implement object serialization must first implement the serializable interface
public class Logon implements java.io.serializable

Thrown when an object needs to be transferred and the class where the object is located does not implement the serialization interface: java.io.NotserializableExceotion

transient is the modifier of the property, which means that the property modified by transient will not be transferred when the object is transferred

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324646808&siteId=291194637