First, the steps of:
Create a source select flow operation (read | write) release
Second, the flow
Node Stream: from a data source | recent program flow
Process Flow: decorative patterns to improve performance enhancements
1, byte stream: it can handle all the (plain text, audio, video, etc.)
1), the input stream InputStream: FileInputStream ByteArrayInputStream
operations: read (array of bytes)
A), the intermediate container byte [] flush = new byte [length]
B), receiving length len = 0 int;
C), the read cycle while ( -1 = (len = flow .read (the flush)))} {!
D), operation: output, copy
2), the output stream OutputStream: FileOutputStream ByteArrayOutputStream
operation: Write (byte array, 0, length) output
2, the character stream: can only handle plain text
1), the input stream: Reader: FileReader
operations: read (character array)
A), the intermediate container char [] flush = new char [length]
B), receiving length len = 0 int;
C), the read cycle while (- 1 = (len = flow .read (the flush)))} {!
D), operation: output, copy
2), the output stream: Writer: FileWriter
operation: Write (character array, 0, length) output
3, commutations: decoding coded character set problem
1), the input stream: InputStreamReader à decode
2), the output stream: OutputStreamWriter-> coding
4, the buffer flow: improved performance
1), the input stream: the BufferedReader BufferedInputStream
2), the output stream: BufferedOutputStream BufferedWriter
5, the data stream: data processing type +
1) Basic string +: must be present to read and write the same order of reading
A), the input stream: DataInputStream readXXX
B), the output stream: the DataOutputStream writeXXX
2), reference types: the Serializable transient
A), deserialization : the ObjectInputStream the readObject
B), the sequence of: ObjectOutputStream writeObject
6, print streams: PrintStream
7、System.in out err setIn setOut
The following flow using the new method does not take place polymorphism [important]
1、 ByteArrayOutputStream: toByteArray()
2、 BufferedReader: readLine()
3、 BufferedWriter:newLine()
4、 DataInputStream DataOutputStream
5、 ObjectInputStream ObjectOutputStream
6、 PrintStream