First, stream concept (stream)
The file class does not read and write the contents of the files.
Reading a file means: Reading the data in the file into memory
Writing a file means: Write the data in memory into a file.
What do you read and write files from? File stream.
1.1. Flow Concept
A series of flowing characters
1.2, the characteristics of the flow
Advanced first-out way to pass information
A sequence of bytes
Directionality: input stream, output stream
Second, according to the flow of the division
Input stream: Read data--inputstream and reader as base class
Output stream: Write Data--outputstream and writer as base class
Altogether four 4 base classes.
Where InputStream and Outputsream are byte streams
where Reader and Writer are character streams
Third, according to the Processing Data Unit Division
Byte stream: bytes input stream, byte output stream
Characters stream: Character input stream, character output stream
Iv. base class of flow
Where InputStream and Outputsream are byte streams: 1 bytes for transmitting data
where Reader and Writer are character streams: 16-bit Unicode characters for transmitting data
4 classes are abstract classes can not be instantiated, need to pass 4 abstract classes provided by the method to implement
V. InputStream Architecture 5.1, byte input stream base class
FileInputStream: Reading data from a file
StringBufferInputStream: Rotate the string into the input stream, this class is obsolete and replaced by Stringbufferreader
PipedInputStream: Connecting a PipedOutputStream It is a pipeline to the inflow
Bytearrayinputstream: The byte array is rotated as an input stream.
Filerinputstream: is a decorative class, also known as a filter, it has the ability to extend the other input stream, it also has the implementation of the sub-class
5.2. Java.io.InputStream Bag
Vi. outputstream architecture 6.1, byte output stream base class
Basically corresponds to the inputstream above
6.2. Java.io.OutputStream Bag
Vii. Reader Flow 7.1, architecture
7.2. Common methods
Eight, writer Stream 8.1, architecture
8.2. Common methods
Ix. steps to use a flow
Open stream-use stream-close stream
Java Starts from scratch 64 (Java io-stream brief)