org.apache.lucene.store

## Class ChecksumIndexInput

- java.lang.Object
- - org.apache.lucene.store.DataInput
  - - org.apache.lucene.store.IndexInput
    - - org.apache.lucene.store.ChecksumIndexInput

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

      public abstract class ChecksumIndexInput
      extends IndexInput

  Extension of IndexInput, computing checksum as it goes. Callers can retrieve the checksum via `getChecksum()`.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ChecksumIndexInput(String resourceDescription)` resourceDescription should be a non-null, opaque string describing this resource; it's returned from `IndexInput.toString()`.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract long` | `getChecksum()` Returns the current checksum value
    `void` | `seek(long pos)` Sets current position in this file, where the next read will occur.

    - ### Methods inherited from class org.apache.lucene.store.IndexInput

      `clone, close, getFilePointer, getFullSliceDescription, length, randomAccessSlice, slice, toString`

    - ### Methods inherited from class org.apache.lucene.store.DataInput

      `readByte, readBytes, readBytes, readInt, readLong, readMapOfStrings, readSetOfStrings, readShort, readString, readVInt, readVLong, readZInt, readZLong, skipBytes`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ChecksumIndexInput

          protected ChecksumIndexInput(String resourceDescription)

      resourceDescription should be a non-null, opaque string describing this resource; it's returned from `IndexInput.toString()`.

  - ### Method Detail

    - #### 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:
        `IndexInput.getFilePointer()`

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.