Basic HTML version of Foils prepared Sept 21 1998

Foil 34 Buffered Text I/O

From Java Tutorial 98- 4: Multi-Treading, Useful Java Classes, I/O and Networking NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken

BufferedReader class for Foil 34
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 Sat Nov 28 1998