1 | To read and write text, numbers, etc., you layer various filters on top of the basic input and output streams. These classes have additional methods to read and write data, both ascii and binary. |
2 |
For example, opening a file and reading lines of text: BufferedReader in = new BufferedReader( new InputStreamReader( new FileInputStream( "filename.txt" ) ) ); while (( line = in.readLine() ) != null ) { buffer.append ( line + "\n"); } in.close ( );
|