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
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
These streams may be "chained" for added functionality:
DataInputStream in =
  • new DataInputStream (new FileInputStream(file));
or
BufferedInputStream in =
  • new BufferedInputStream (new FileInputStream(file));
where file is a filename string.



© 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