Filtered streams are used to process data as its being written to/read from the stream. This to remember is that if you want to use a filtered input/output stream, then you must attach the filtered stream to another input/output stream. An example follows below:
Java Code:
DataInputStream dis = new DataInputStream(;
String input;

while ((input = dis.readLine()) != null) {