Package hec.server

Class TimeWindowFileReader

java.lang.Object
hec.server.TimeWindowFileReader

public class TimeWindowFileReader extends Object
  • Constructor Details

    • TimeWindowFileReader

      public TimeWindowFileReader()
  • Method Details

    • findStartOffset

      public long findStartOffset(File file, String startTimeString)
    • findEndOffset

      public long findEndOffset(File file, String endTimeString, long fileStartOffset)
      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 time
      randomAccessFile - 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

      protected boolean isTimestampedFile(RandomAccessFile raf) throws IOException
      Throws:
      IOException
    • getTimestampFileIdentficationLineCount

      protected int getTimestampFileIdentficationLineCount()
    • getDefaultTimestampFileIdentificationLineCount

      protected int getDefaultTimestampFileIdentificationLineCount()
    • getLineTimeIdentificationPattern

      protected Pattern getLineTimeIdentificationPattern()
    • getTimeFormatter

      protected DateTimeFormatter getTimeFormatter()
    • getTimeFormatLength

      protected int getTimeFormatLength()
    • getNewlineLength

      protected int getNewlineLength()