Class RandomAccessLineReader
java.lang.Object
net.thevpc.common.io.RandomAccessLineReader
- All Implemented Interfaces:
AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbackward()voidclose()longlonglongvoidforward()longlongbooleanhasMore()final StringreadLine()readLine(long offset) read string at the given line number.protected intreadNext()protected intvoidseekEnd()voidseekLine(long offset) voidvoidlongskipLines(long x) skip x lines in the current orientationprotected final booleanprotected final booleanvoid
-
Constructor Details
-
RandomAccessLineReader
- Throws:
FileNotFoundException
-
-
Method Details
-
readLine
read string at the given line number. orientation will not be altered after this call even though offset may be <= getNextLineNumber()- Parameters:
offset- number of the line to read- Returns:
- read line
- Throws:
IOException- if i/O error
-
readLine
- Throws:
IOException
-
skipLines
skip x lines in the current orientation- Parameters:
x- number of lines to skip. ignored if <= 0- Returns:
- number of lines read
- Throws:
IOException- when I/O error
-
nextForwardLine
- Throws:
IOException
-
nextBackwardLine
- Throws:
IOException
-
skipPreviousNewLine
- Throws:
IOException
-
skipNextNewLine
- Throws:
IOException
-
getNextLineNumber
public long getNextLineNumber() -
getLastLineNumber
public long getLastLineNumber() -
readNext
- Throws:
IOException
-
readPrevious
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
forward
- Throws:
IOException
-
backward
- Throws:
IOException
-
switchOrientation
- Throws:
IOException
-
setOrientation
- Throws:
IOException
-
seekLine
- Throws:
IOException
-
seekStart
- Throws:
IOException
-
seekEnd
- Throws:
IOException
-
fileLength
- Throws:
IOException
-
countLines
- Throws:
IOException
-
countReadableLines
- Throws:
IOException
-
getOrientation
-
hasMore
- Throws:
IOException
-