Initially Java does not support the processing of text files, in order to make up for this shortcomings, two classes are introduced, these two classes are abstract classes, Write in Writer (char [] ch, int OFF, INT LENGTH) , Flush () and close () methods are abstract methods, read (char [] ch, int off, int layth) and close () methods are abstract methods. Subcombs should be achieved separately. When we read and write text files, it is very convenient to use Reader, such as FileReader, InputStreamReader, and BufferedReader. The most important classes are InputStreamReader, which is a bridge that is converted to characters. You can redeemed the encoding in the constructor, if not specified, the default encoding method of the underlying operating system, such as GBK, etc. When using FileReader reads files. FileReader fr = new fileReader ("ming.txt"); int CH = 0; while ((ch = fr.read ())! = - 1) {system.out.print ((char) ch);} where read () The method returns to read the next character. Of course, you can also use read (char [] ch, int off, intleth, which is similar to the processing binary, not much. If you use InputStreamReader to read the file when you read the file ((ch = isr.read ())! = - 1) {system.out.print ((char) ch);} This is nothing difference, in fact, The method in the FileReader is inherited from the InputStreamReader. The READ () method is more effective, and if we can use BufferedReader to pack Reader in order to improve efficiency, this can improve the read speed, we can read the text in a row, use the readline () method. BufferedReader br = new BufferedReader (new InputStreamReader (new FileInputStream ( "ming.txt"))); String data = null; while (! (Data = br.readLine ()) = null) {System.out.println (data) When you understand how to use Reader to read text files, use Writer write files is also very simple. One thing to pay attention to, when you write the file, in order to improve efficiency, the written data will first put into the buffer and write to the file. So sometimes you need to actively call the Flush () method.