JDK-1204354 : java.io: Need EOF constant
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.0
  • Priority: P5
  • Status: Closed
  • Resolution: Won't Fix
  • OS: solaris_2.5
  • CPU: sparc
  • Submitted: 1995-05-03
  • Updated: 2002-05-07
  • Resolved: 2002-05-07
Description
It would be nice ... if the I/O classes defined an EOF constant that
people could use to check for EOF rather than using -1,like this:

     while (System.in.read() != EOF)
            . . . 

Comments
EVALUATION The I/O classes are well-specified to return -1 on EOF, or throw an EOFException. Adding a constant to InputStream and Reader (is that sufficient) might, however, make things a little clearer. -- mr@eng 12/15/1997 Will not fix. This isn't any more compelling three years later. -- ###@###.### 2002/5/7
15-12-1997