Basic HTML version of Foils prepared 17 Nov 97

Foil 33 FilterInputStreams

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

FilterInputStream subclasses for Foil 33
1 Subclasses of FilterInputStream are used to add value to a raw InputStream. You can define your own filters but useful ones are already provided in java.io:
  • BufferedInputStream -- establishes an intermediate buffer to service the stream
  • DataInputStream -- has methods to input other data types besides bytes (char, double, boolean, etc.)
  • PushbackInputStream -- allows one to "unread" a byte and put it back in the input stream
2 These streams may be "chained" for added functionality:
3 DataInputStream in =
  • new DataInputStream (new FileInputStream(file));
4 or
5 BufferedInputStream in =
  • new BufferedInputStream (new FileInputStream(file));
6 where file is a filename string.

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