Package org.apache.commons.io.input
Class ReversedLinesFileReader.FilePart
java.lang.Object
org.apache.commons.io.input.ReversedLinesFileReader.FilePart
- Enclosing class:
ReversedLinesFileReader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate final byte[]private byte[]private final long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateFilePart(long no, int length, byte[] leftOverOfLastFilePart) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidConstructs the buffer containing any leftover bytes.private intgetNewLineMatchByteCount(byte[] data, int i) Finds the new-line sequence and return its length.private StringreadLine()Reads a line.private ReversedLinesFileReader.FilePartrollOver()Handles block rollover
-
Field Details
-
no
private final long no -
data
private final byte[] data -
leftOver
private byte[] leftOver -
currentLastBytePos
private int currentLastBytePos
-
-
Constructor Details
-
FilePart
Constructs a new instance.- Parameters:
no- the part numberlength- its lengthleftOverOfLastFilePart- remainder- Throws:
IOException- if there is a problem reading the file
-
-
Method Details
-
createLeftOver
private void createLeftOver()Constructs the buffer containing any leftover 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
Reads a line.- Returns:
- the line or null
-
rollOver
Handles block rollover- Returns:
- the new FilePart or null
- Throws:
IOException- if there was a problem reading the file
-