I wish to write a program which mimics the unix "tail -f" command using a
. However, the program must work with UTF-8 encoded files.
There is an implementation described at http://www.informit.com/guides/content.asp?g=java&seqNum=226&rl=1, but it assumes the default system encoding.
Could anyone tell me if what I am trying to do is even possible. I have resorted to using a
instead, but it is not as neat a solution since it is important that the
method blocks until a newline character is read.
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?