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
For buffered text output, use the character stream:
BufferedWriter out =
  • new BufferedWriter(
  • new OutputStreamWriter(
  • new FileOutputStream( filename ) ) );
Similarly, for buffered text input, use:
BufferedReader in =
  • new BufferedReader(
  • new InputStreamReader(
  • new FileInputStream( filename ) ) );
Optionally use the subclasses FileWriter and FileReader for brevity (as in the previous foil).
Note that the BufferedReader class has a handy readLine() method for sequential text input.



© 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