How to check EOF in Binary File
In text file we use below to check EOF.
VB Code:
InputStreamReader os = new InputStreamReader(.........);
int ch;
while((ch=os.read()) != -1){ //Check whether EOF or not
//Output Something
}
But in binary file i don't how to check EOF
VB Code:
DataInputStream os = new DataInputStream(.........);
System.out.println(os.readInt());
System.out.println(os.readFloat());
I don't how used loop to print content of file until EOF. Please tell me.
Re: How to check EOF in Binary File
I think that the condition is quite similar,the object becomes -1 at EOF,so just check for that condition.
Re: How to check EOF in Binary File
You can call "os.available()"
it returns available number of bytes cna be read from this stream