Package hec.server
Class TimeWindowFileReader
java.lang.Object
hec.server.TimeWindowFileReader
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongfindEndOffset(File file, String endTimeString, long fileStartOffset) Finds the very last line in _file with the time in the specified minutelongfindStartOffset(File file, String startTimeString) protected longfindTimeOffset(long start, LocalTime time, RandomAccessFile randomAccessFile) Binary search to find the specified time (to the minute).protected intprotected Patternprotected intprotected intprotected DateTimeFormatterprotected intprotected boolean
-
Constructor Details
-
TimeWindowFileReader
public TimeWindowFileReader()
-
-
Method Details
-
findStartOffset
-
findEndOffset
Finds the very last line in _file with the time in the specified minute- Parameters:
fileStartOffset- The start offset (0 if unknown). Usually the output for findStartOffset()- Returns:
- The offset of the start of the very last line in a file that is at the specified time
-
findTimeOffset
protected long findTimeOffset(long start, LocalTime time, RandomAccessFile randomAccessFile) throws IOException Binary search to find the specified time (to the minute). A line with the specified time will start at the returned offset, but it may or may not be the first or last line with the specified time. The specified file is expected to be in chronological order. The file pointer location of raf is not guaranteed after this code has run.- Parameters:
start- The start offset.time- The desired timerandomAccessFile- The file to search (expected to be ordered)- Returns:
- An offset in the file that corresponds to the beginning of a line with the specified time to the minute or -1 if not found.. It may or may not be the first or last line with that time.
- Throws:
IOException
-
isTimestampedFile
- Throws:
IOException
-
getTimestampFileIdentficationLineCount
protected int getTimestampFileIdentficationLineCount() -
getDefaultTimestampFileIdentificationLineCount
protected int getDefaultTimestampFileIdentificationLineCount() -
getLineTimeIdentificationPattern
-
getTimeFormatter
-
getTimeFormatLength
protected int getTimeFormatLength() -
getNewlineLength
protected int getNewlineLength()
-