Basic HTML version of Foils prepared 17 Nov 97

Foil 37 Buffered Text I/O

From Java Tutorial, July 1, 1996 CEWES Tutorial, CPS606, JSU Class CSC499 -- July 22-25 1997, Fall 97. by Nancy J. McCracken,Geoffrey C. Fox, Tom Scavo

BufferedReader class for Foil 37
1 For buffered text output, use the character stream:
2 BufferedWriter out =
  • new BufferedWriter(
  • new OutputStreamWriter(
  • new FileOutputStream( filename ) ) );
3 Similarly, for buffered text input, use:
4 BufferedReader in =
  • new BufferedReader(
  • new InputStreamReader(
  • new FileInputStream( filename ) ) );
5 Optionally use the subclasses FileWriter and FileReader for brevity (as in the previous foil).
6 Note that the BufferedReader class has a handy readLine() method for sequential text input.

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 Wed Apr 1 1998