Basic HTML version of Foils prepared Sept 21 1998

Foil 30 FilterInputStreams

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

FilterInputStream subclasses for Foil 30
Subclasses of FilterInputStream are used to convert a raw InputStream to one with added value. 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 Sat Nov 28 1998