DataReader.java

import java.io.*;

/**
Demonstrate DataInputStream, layered streams.
*/
public class DataReader
{
    public static void main(String[] argv)
    {
        try {
            DataInputStream dis = 
                new DataInputStream(
                    new BufferedInputStream(
                        new FileInputStream(
                            new File("bozo.dat")
                            ),
                        4096));
            while (true) {
                try {
                    double x = dis.readDouble();
                    System.out.println(x);
                    }
                catch (EOFException eof) {
                    break;
                    }
                }
            dis.close();
            }
        catch (IOException e) {
            System.err.println(e);
            }
    }
}