A typical IO operation is the read InputStream and OutputStream to wite (byte b) as the standard, InputStream time to receive one or more bytes, while the OutputStream will write one or more bytes.
Emerged from JDK1.1 to start operating as a standard character Reader and Write, Reader first to read one or more characters, while the Writer to write one or more characters. The IO operations are carried out around this topic.
StringBufferInputStream, outdated, in the old version to read a byte. Reader has been replaced by the corresponding subclass
1, InputStreamReader InputStream byte stream is a bridge leading characters flow through the packing InputStream to Reader can read the character way.
2, OutputStreamWriter is a character stream OutputStream bridge leading to a byte stream through the packing OutputStream can write characters the way to Writer.
3, FileInputStream and FileOutputStream classes are two more special, the two classes InputStream to OutputStream were holding a reference, through the decorated model, can easily add some extra features.
BufferedInputStream and BufferedOutputStream is a subclass of the two provides a buffer and reduce the interaction with the physical device.
4, Reader and Writer can not Stream less complex, BufferedReader and BufferedWriter, were directly inherited from the Reader and Writer classes.
5, Reader and Writer is a platform default character encoding to read or write, the need to specify the encoding used InputStreamReader and OutputstreamWriter.
6, who is due to the use of decorative patterns, was created IO code written today layers of packaging, "unsightly." The layers of packaging requires no special memory, has its own characteristics.
When you need to use files based on byte stream stream new FileInputStream, the outer disk plus a BufferedInputStream to reduce interaction with, then became the InputStream = new BufferedInputStream (new FileInputStream ()); OutputStream also the same reason;
When you need to use character-based stream file stream new FileReader, also need to add buffer, then a new BufferedReader (new FileReader ()). Need to specified encoding, then a new BufferedReader (new InputStreamReader (new FileInputStream (path), encoding));
7, InputStream, OutputStream, Reader, Writer are the abstract class
8, ObjectInputStream and ObjectOutputStream basic types are used for reading and writing.