2015-04-20 15:36:01 -07:00
|
|
|
//: io/TestEOF.java
|
|
|
|
// 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)
|
2015-04-29 12:53:35 -07:00
|
|
|
System.out.write(in.readByte());
|
2015-04-20 15:36:01 -07:00
|
|
|
}
|
2015-05-05 11:20:13 -07:00
|
|
|
} /* (Execute to see output) *///:~
|