modified BufferedReader to ignore last line
<p>I want to use something like BufferedReader to read lines from a file but if the last line in the file does not end with a newline character, I would like it to be ignored. The standard BufferedReader will return the last line up to EOF, which is not what I want. So far, the best thing I've come up with is to copy the BufferedReader source, modify one line about handling EOFs and call it something like BufferedCompleteLineReader.. this doesn't seem very good though. Does anyone have a better idea?</p>

<p>The background is there are multiple readers making requests to read a file that is periodically appended with a new line of text (i.e. a log file) but each new line is only valid if it ends with a newline char. If I read the last line while it's being modified I'll get bad data. But I don't want to impose file locking because performance is more important to me than completeness (for the reader).</p>
