A: The concept of stream design
Java abstracts the input/output into streams, the source and destination of the data, and the stream object that connects the two. Metaphor
, the data is like water, a stream is a pipe, and the water flows from one end to the other through the connection of the pipe.
When you do not use InputStream and outputstream, you must use the close () method to close the stream.
Two: Streaming inheritance architecture
Common class inheritance schemas for 1.InputStream:
Common class inheritance schemas for 2.OutputStream:
Note: FileInputStream, FileOutputStream is in bytes when reading, writing to the document
III: Stream Processing Adorner
The commonly used packager has the function of buffer bufferedinputstream, Bufferedoutputstream, with data conversion processing DataInputStream, DataOutputStream, With the ability of object serialization ObjectInputStream,
ObjectOutputStream and so on. Since these classes themselves do not change the behavior of InputStream, OutputStream, but after the InputStream to obtain data, then do some processing, or to do some processing in the output, and then by the OutputStream really output, They are therefore called adorners (Decorator).
Several commonly used stream decorator classes:
Bufferedinputstream and Bufferedoutputstream. DataInputStream and DataOutputStream. ObjectInputStream and ObjectOutputStream.
Four: Character processing classes
1.Reader and Writer Inheritance architecture
2. Character processing Adorner
InputStreamReader and OutputStreamWriter
BufferedReader and BufferedWriter
PrintWriter:
PrintWriter is very similar to PrintStream, except that it can be packaged in OutputStream,
PrintWriter can also package Writer, providing methods such as print (), println (), Format (), and so on.
Java Basic IO Framework