If EOF (End of File)flag in Java like there is in .NET.

If yes in which class is it present.

The problem I am facing is that i cannot edit the input file and the values are present in very alternate line.

Therefore I cannot ensure whether the entire file is read.

Please Help.

Each read method has its own way of signalling EOF when you attempt to read past the end of file, eg returning -1 for the number of bytes read. Because some read methods return (eg) Strings don't return a number, they have to signal EOF some other way, such as returning a null. Check the API doc for the read method(s) you are using to see how they return EOF.

Thank you for Replying.

But the real Problem occurs when there are empty lines between input values.

When the readLine() pointer hits those lines it returns null and I cannot edit the source file. Iam no allowed to do that.

For Example Suppose we need to find the smallest number If for this the input file would be like...

3(denoting 3 three numbers are going to follow then .....)

808

2133

234

Are you certain? Do you have a test case that shows that behaviour?
readLine will return a zero-length String (ie "") for an empty line; that's completely different from a null value.

The readLine() method that you use, in which class it belongs to? Because if you use the BuffereReader class, then when that method returns null it means that it has reached the end of the file.
If the file's last line is for example: "aaa"
Then when you call the readLine, for the last line it will return the: "aaa" and if you call it again it will return null.

If you are using Scanner, check the API for the method hasNextLine (I think)

In your case, take the line, and handle it only if it is not empty !line.trim().equals("")

Thank You Java Addict and James Cherril
I think You are correct about the "" character rather than the null character.
And as far as hasNextLine() is concerned the method i found in the API is hasNext() which returns String

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.