2015-11-15 15:51:35 -08:00

19 lines
600 B
Java

// iostreams/TestEOF.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Testing for end of file while reading a byte at a time.
import java.io.*;
public class TestEOF {
public static void main(String[] args)
throws IOException {
DataInputStream in = new DataInputStream(
new BufferedInputStream(
new FileInputStream("TestEOF.java")));
while(in.available() != 0)
System.out.write(in.readByte());
}
}
/* Output: (Execute to see) */