I have to read the tomcat log file,and after some time(for example:one hour) I will read the file again(just for the new added content),so I create the RandomAccessFile to recor
readLine() strips EOL characters so you don't see it. There is no difference between EOF and EOL from its point of view which is troubling in your case. In addition to Peter's solution, you can try seeking one byte back after you read the line and check if it was EOL or not. Be careful about line ending style being used, though.