flujo de entrada de datos usando while loop
try(DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(new File("text.dat")))))
{
//reading in integers from the file.
int number;
while(dis.available() >0)
{
number = dis.readInt();
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
Thulani Stephans