?EOF character for file of integers

How end of file character is traced in an file of integers for simple java applications using streams
[108 byte] By [deepali_dta] at [2007-11-27 3:32:30]
# 1

What is an EOF character?

public abstract int read() throws IOException

/*

Reads the next byte of data from the input stream.

The value byte is returned as an int in the range 0 to 255.

If no byte is available because the end of the stream has been reached,

the value -1 is returned.

This method blocks until input data is available,

the end of the stream is detected, or an exception is thrown.

*/

BIJ001a at 2007-7-12 8:35:31 > top of Java-index,Java Essentials,Java Programming...
# 2
catch EOFException?
Alandera at 2007-7-12 8:35:31 > top of Java-index,Java Essentials,Java Programming...
# 3
thanx fr ur responsebut i wanna kno if I take input from the user in form of integers store them in a file and then to read it ,if i use read() it cannot read integers like 23, 287, 24556 and if i use readInt() it cannot trace -1 as eof character
deepali_dta at 2007-7-12 8:35:31 > top of Java-index,Java Essentials,Java Programming...
# 4
How do you read and write your integers? Did you consider using Data*putStreams for that, because that's what they're there for?
CeciNEstPasUnProgrammeura at 2007-7-12 8:35:31 > top of Java-index,Java Essentials,Java Programming...
# 5
thanx fr ur responsebut i wanna kno if I take input from the user in form of integers store them in a file and then to read it ,if i use read() it cannot read integers like 23, 287, 24556 and if i use readInt() it cannot trace -1 as eof character
deepali_dta at 2007-7-12 8:35:31 > top of Java-index,Java Essentials,Java Programming...
# 6

thanx fr ur response

but i wanna kno if I take input from the user in form of integers store them in a file and then to read it ,if i use read() it cannot read integers like 23, 287, 24556 and if i use readInt() it cannot trace -1 as eof character

For input and output of integres i'm associating dataInput dataoutputstreams with file streams

deepali_dta at 2007-7-12 8:35:31 > top of Java-index,Java Essentials,Java Programming...
# 7
Please spell correctly. Anyway, read() reads a byte and yields it as an int as described in the API and cited above. If you want to read a multibyte integer, you have to know how it is composed. If you need textual representation, it is a different situation.
BIJ001a at 2007-7-12 8:35:31 > top of Java-index,Java Essentials,Java Programming...
# 8
readInt() throws EOFException at end of file.Just like it says in the Javadoc. Nothing there about it returning -1 at EOF.
ejpa at 2007-7-12 8:35:31 > top of Java-index,Java Essentials,Java Programming...