We would like to know how to read int from a Buffered Stream.
// ww w . j a va 2 s. c o m import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; public class MainClass { public static void main(String[] args) throws IOException { DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream( "temp.tmp"))); for (int i = 0; i < 10; i++) dis.readInt(); dis.close(); } }
The code above generates the following result.