| Author |
Need help with EOFException error
|
Bob Zoloman
Ranch Hand
Joined: Jul 02, 2006
Posts: 72
|
|
Hi, I am trying to fix the following error. java.io.EOFException at java.io.DataInputStream.readChar(Unknown Source) at Decode.main(Decode.java:27) I have tried using conditions by the first is.readChar() method to test for false and blank characters, but nothing seems to work. Any help is appreciated.
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24039
|
|
|
Every time through the "while" loop, at least one character is read (at the top of the loop.) Under what circumstances does the loop exit? Should you perhaps be exiting under any other circumstances? Or is this an infinite data stream?
|
[Jess in Action][AskingGoodQuestions]
|
 |
Bob Zoloman
Ranch Hand
Joined: Jul 02, 2006
Posts: 72
|
|
I would like to exit when there are no more characters in the file. I'm not sure how to do that. I have tried conditions in the while loop such as; etc but none of them work. The data stream is something like this. 000100000111110000001 in a textfile. [ August 05, 2006: Message edited by: Bob Zoloman ] [ August 05, 2006: Message edited by: Bob Zoloman ]
|
 |
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
|
|
|
An EOFException indicates that the end of the file has been reached. So if you catch this exception, you know you've reached the end of the file.
|
Joanne
|
 |
 |
|
|
subject: Need help with EOFException error
|
|
|