I'm wondering if anyone knows of any java util library (like Apache Commons) that has an efficient and tested java implementation of the unix tail command? By effective I mean that it should be able to handle very large files (>1GB), with various unknown line lengths, quickly without lots of I/O or high memory usage. And by tested I mean something that can safely be used in production environments. In short, something as safe and efficient (well almost at least) as the tail command on some unix OS.
The reason I'm asking this is because I want to be able to display a server log file in a administration webapplication, and since the log file can grow very large I only want to show the last N lines. But I was amazed to notice that I couldn't seem to find any "java tail" function. I found a lot of different code examples, but that doesn't help me much. This seems like such a low level function that it should really exist in a tested, efficient and hopefully nearly bug free java util library. Writing it myself (even if that means copy pasting example code from some forum) is way to error prone for my taste.
So, does anyone know of any such existing such java util library? Preferably one that exists in a standard maven repository.
Regards
/Jimi