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.
|