Class LogFileTail
java.lang.Object
eu.mrapik.minecraftservermcp.util.LogFileTail
Reads the tail of a UTF-8 text file without loading the whole file into memory.
-
Method Summary
-
Method Details
-
readTail
Reads at mostmaxBytesfrom the end of the file, then keeps at mostmaxLineslines (counting newlines). If the read starts mid-line, the first fragment is dropped.- Parameters:
file- path to a regular filemaxBytes- maximum bytes read from the end of the filemaxLines- maximum number of lines to return after splitting- Returns:
- tail text, or
""if limits are non-positive, the path is not a file, or the file is empty - Throws:
IOException- if the file cannot be read
-