in encryption/src/main/java/org/apache/solr/encryption/crypto/DecryptingIndexInput.java [216:242]
public void readBytes(byte[] b, int offset, int length) throws IOException {
if (offset < 0 || length < 0 || offset + length > b.length) {
throw new IllegalArgumentException("Invalid read buffer parameters (offset=" + offset + ", length=" + length
+ ", arrayLength=" + b.length + ")");
}
if (getPosition() + length > sliceEnd) {
throw new EOFException("Read beyond EOF (position=" + (getPosition() - sliceOffset) + ", arrayLength=" + length
+ ", fileLength=" + length() + ") in " + this);
}
while (length > 0) {
// Transfer decrypted bytes from outBuffer.
int outRemaining = outSize - outPos;
if (outRemaining > 0) {
if (length <= outRemaining) {
System.arraycopy(outBuffer, outPos, b, offset, length);
outPos += length;
return;
}
System.arraycopy(outBuffer, outPos, b, offset, outRemaining);
outPos += outRemaining;
offset += outRemaining;
length -= outRemaining;
}
readToFillBuffer(length);
decryptBuffer();
}
}