This content has been marked as final. Show 4 replies
Look at the RAF readUTF method. With appropriate modifications to the program you linked to, it should work.
I was thinking of using readUTF(), but it doesn't seem to read until the end of line, but until the end of file. That is, it could possibly return a string which is not delimited by a newline. So if another process is writing into a log file we could end up with reading records half way into the line.
Is this correct?
No read method anywhere will block when it encounters end of file, so your reasons for preferring the RandomAccessFile aren't valid. Use a BufferedReader and sleep while in.ready() is false.
I see, thanks!