public void seek()

in encryption/src/main/java/org/apache/solr/encryption/crypto/DecryptingIndexInput.java [155:173]


  public void seek(long position) throws IOException {
    if (position < 0) {
      throw new IllegalArgumentException("Invalid position=" + position);
    }
    if (position > length()) {
      throw new EOFException("Seek beyond EOF (position=" + position + ", length=" + length() + ") in " + this);
    }
    long targetPosition = position + sliceOffset;
    long delegatePosition = indexInput.getFilePointer();
    long currentPosition = delegatePosition - (outSize - outPos);
    if (targetPosition >= currentPosition && targetPosition <= delegatePosition) {
      // The target position is within the buffered output. Just move the output buffer position.
      outPos += (int) (targetPosition - currentPosition);
      assert targetPosition == delegatePosition - (outSize - outPos);
    } else {
      indexInput.seek(targetPosition);
      setPosition(targetPosition);
    }
  }