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 int
private final byte[]
private byte[]
private final long
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
FilePart
(long no, int length, byte[] leftOverOfLastFilePart) ctor -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Creates the buffer containing any left over bytes.private int
getNewLineMatchByteCount
(byte[] data, int i) Finds the new-line sequence and return its length.private String
readLine()
Reads a line.private ReversedLinesFileReader.FilePart
rollOver()
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
ctor- Parameters:
no
- the part numberlength
- its lengthleftOverOfLastFilePart
- remainder- Throws:
IOException
- if there is a problem reading the file
-
-
Method Details
-
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
Reads a line.- Returns:
- the line or null
- Throws:
IOException
- if there is an error reading from the file
-
rollOver
Handles block rollover- Returns:
- the new FilePart or null
- Throws:
IOException
- if there was a problem reading the file
-