Package org.apache.commons.io.input
Class ReversedLinesFileReader.FilePart
- java.lang.Object
-
- org.apache.commons.io.input.ReversedLinesFileReader.FilePart
-
- Enclosing class:
- ReversedLinesFileReader
private class ReversedLinesFileReader.FilePart extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private intcurrentLastBytePosprivate byte[]dataprivate byte[]leftOverprivate longno
-
Constructor Summary
Constructors Modifier Constructor Description privateFilePart(long no, int length, byte[] leftOverOfLastFilePart)ctor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcreateLeftOver()Creates the buffer containing any left over bytes.private intgetNewLineMatchByteCount(byte[] data, int i)Finds the new-line sequence and return its length.private java.lang.StringreadLine()Reads a line.private ReversedLinesFileReader.FilePartrollOver()Handles block rollover
-
-
-
Method Detail
-
createLeftOver
private void createLeftOver()
Creates the buffer containing any left over bytes.
-
getNewLineMatchByteCount
private int getNewLineMatchByteCount(byte[] data, int i)Finds the new-line sequence and return its length.- Parameters:
data- buffer to scani- start offset in buffer- Returns:
- length of newline sequence or 0 if none found
-
readLine
private java.lang.String readLine() throws java.io.IOExceptionReads a line.- Returns:
- the line or null
- Throws:
java.io.IOException- if there is an error reading from the file
-
rollOver
private ReversedLinesFileReader.FilePart rollOver() throws java.io.IOException
Handles block rollover- Returns:
- the new FilePart or null
- Throws:
java.io.IOException- if there was a problem reading the file
-
-