design of reader and writer character streams:FileReader is a subclass of InputStreamReader, and InputStreamReader is a subclass of reader; FileWriter is a subclass of OutputStreamWriter, And OutputStreamWriter is the subclass of writer. The difference between a character stream and a byte stream is that the character stream operation object is an array of characters and characters, and the byte-stream operation object is an array of bytes and bytesRead file: (Reader Class)int read ();     Reads a single character int read (char[] c) from the input stream; Read (char[] c,int off,int len);      Starting from off, up to Len length, save Bvoid Close (); ReadLine ()///only suitable for reading arow ( blocking function)
Reader subclass Filreader, constructs FileReader (String name); Reader subclass BufferedReader: With buffer, avoid each time from the data source to read data, character encoding conversion; Construct Bfferedreader (Reader in)Write Text file: (writer Class)Write (string str) outputs the characters contained in the STR string to the output stream write (string str,int off,int len) close () void flush ()//Flush output stream writer subclass FileWriter, constructs FileWriter (String name);Writer sub-class BufferedWriterConstructionBufferedWriter(Writer in)
Reader character Stream