Basic HTML version of Foils prepared 17 Nov 97

Foil 38 A Monster Chain

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

Buffered Reader/Writer classes for Foil 38
1 The buffered output construct in the previous foil is of limited use since BufferedWriter has so few output methods. Instead, use the "monster" chain:
2 PrintWriter out =
  • new PrintWriter(
  • new BufferedWriter(
  • new OutputStreamWriter(
  • new FileOutputStream( filename ) ) ) );
3 which can be shortened somewhat by using FileWriter as shown earlier.
4 The PrintWriter class defines print(...) and println(...) methods for all primitive types, which unlike other Reader/Writer classes never throw exceptions.

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