1. File classes: Files, also the only separate file class. You can manipulate files. The method is: exists (), delete (), iddirectory (), CreateNewFile (), GetName (), GetPath ()
2. The stream is divided into input and output streams, followed by byte and character input and output streams.
(1) Inputstream,outputstream, which is the input and output stream of the parent class. is the input and output stream of the byte. The main method is read (), when read () =-1 is the end. Write is the output of bytes .
(2) Reader,writer, which is the input and output stream of the parent class. is the input and output stream of the character. The Main method is read (), when read () =-1 is the end. Write is the output of the character .
3. The byte stream is converted into a character flow bridge.
(1) InputStreamReader, this class converts an input stream into a character stream as a byte.
(2) OutputStreamWriter, this class converts the output stream to bytes into a character stream.
For the above class, the conversion, that is, the stream successfully converted into characters, if you want to input, directly with the character stream output can be.
1 Public Static voidMain (string[] args)throwsIOException {2File file1=NewFile ("d:\\", "A.txt");3File file2=NewFile ("d:\\", "B.txt");4FileInputStream fs1=NewFileInputStream (file1);5InputStreamReader f1isr=NewInputStreamReader (FS1);6 //It's not hard to find out that the output byte stream is replaced by a character flow.7FileWriter fw2=NewFileWriter (file2);8 intcontents;9 while((Contents=f1isr.read ())!=-1){Ten Fw2.write (contents); One } A fs1.close (); - fw2.close (); -}
4.BufferedReader and BufferedWriter
This is a unit of behavior, the operation of the row, the line input and output. The method has a readline () that is equal to Null,newline () to generate a new row.
Some basic knowledge of Java I/O operations