Basic HTML version of Foils prepared July 6 99

Foil 53 I/O with Streams

From Use of Java Language in Computational Science DoD Modernization Users Group Conference Monterey -- June 7 99. by Nancy McCracken, Geoffrey C. Fox


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 ( );

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Tue Jul 6 1999