Class ChecksumIndexInput

All Implemented Interfaces:
Closeable, AutoCloseable, Cloneable
Direct Known Subclasses:
BufferedChecksumIndexInput, EndiannessReverserChecksumIndexInput

public abstract class ChecksumIndexInput extends IndexInput
Extension of IndexInput, computing checksum as it goes. Callers can retrieve the checksum via getChecksum().
  • Field Details

    • SKIP_BUFFER_SIZE

      private static final int SKIP_BUFFER_SIZE
      See Also:
    • skipBuffer

      private byte[] skipBuffer
  • Constructor Details

    • ChecksumIndexInput

      protected ChecksumIndexInput(String resourceDescription)
      resourceDescription should be a non-null, opaque string describing this resource; it's returned from IndexInput.toString().
  • Method Details

    • getChecksum

      public abstract long getChecksum() throws IOException
      Returns the current checksum value
      Throws:
      IOException
    • seek

      public void seek(long pos) throws IOException
      Sets current position in this file, where the next read will occur. If this is beyond the end of the file then this will throw EOFException and then the stream is in an undetermined state.

      ChecksumIndexInput can only seek forward and seeks are expensive since they imply to read bytes in-between the current position and the target position in order to update the checksum.

      Specified by:
      seek in class IndexInput
      Throws:
      IOException
      See Also:
    • skipByReading

      private void skipByReading(long numBytes) throws IOException
      Skip over numBytes bytes. The contract on this method is that it should have the same behavior as reading the same number of bytes into a buffer and discarding its content. Negative values of numBytes are not supported.
      Throws:
      IOException