Class ReverseLineByteStream
java.lang.Object
edu.stanford.slac.archiverappliance.PB.utils.ReverseLineByteStream
- All Implemented Interfaces:
Closeable,AutoCloseable
A modification of LineByteStream optimized for reading a PB chunk backwards in time
Based off of dpetruha's answer here - https://stackoverflow.com/questions/8664705/how-to-read-file-from-end-to-start-in-reverse-order-in-java
- Author:
- mshankar
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionReverseLineByteStream(Path path) ReverseLineByteStream(Path path, long startPosition, long endPosition) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()longMainly used in the unit testsbooleanvoidvoidseekToBeforePreviousLine(long posn)
-
Field Details
-
MAX_LINE_SIZE
public static final int MAX_LINE_SIZE- See Also:
-
-
Constructor Details
-
ReverseLineByteStream
- Throws:
IOException
-
ReverseLineByteStream
- Throws:
IOException
-
-
Method Details
-
seekToBeforePreviousLine
- Throws:
IOException
-
readLine
- Throws:
IOException
-
safeClose
public void safeClose() -
getAbsolutePath
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getTotalBytesRead
public long getTotalBytesRead()Mainly used in the unit tests
-