1. I/O operations refer to the operation of the input and output streams. Relative memory, when we read data from the data source into memory, is the input stream, also called the read stream. When we write data that is processed in memory to a data source, it is the output stream, also called the write stream.
2, stream by content classification: byte stream, character stream, object flow.
In fact, there is only one kind of stream: byte stream. The transmission of data is in binary mode at the bottom, so no matter what kind of stream, it is a byte stream. The character stream and object flow are encapsulated on a byte stream basis to facilitate manipulation of character data and object data.
3. The parent class of all byte streams: InputStream and OutputStream.
Parent class for all character streams: Reader and writer
4, the flow operation steps:
Establish a stream: establish a channel for transferring data between the memory and the data source;
Operation Flow: The data transmitted by the operation;
Close the stream: Closes the channel between the memory and the data source, freeing the resource.
5. When the file stream is manipulated, if the file does not exist, the read stream throws FileNotFoundException, and the write stream creates a new file, provided the directory where the file resides must exist. If the directory does not exist, it will also throw filenotfoundexception.
6. After the flow is used, it must be closed. If you do not close, waste memory resources, in addition, the write stream may not write data.
7. File class:
- GetName (), get the file name;
- GetParent (), get the file directory;
- GetAbsolutePath () to obtain the absolute path of the file;
- Exists (), determine whether the file exists;
- Isfile () to determine whether the object is a file;
- Isdirectory (), determine whether the object is a directory;
- Listfiles (), get a list of all the files in a directory, including the files and directories, but not the contents of subdirectories;
- Delete (), remove the file or directory (when you delete the directory), you must ensure that the directory is empty.
- mkdir () to create a directory of the specified path
8. Recursion: Call the same method in one method.
9, object serialization: When the object is needed for data transmission, because of the large size of the object, so before the transfer of objects need to break up the object into a sequence of bytes, to facilitate transmission. This process, called object serialization. When you arrive at your destination, you need to restore the sequence of bytes to an object, which is called deserialization.
Java object-oriented programming--17th I/O system