@Override
    public int available() throws IOException {
        abortIfNeeded();
        int available = this.decryptedContents.available();
        if(available < this.virtualAvailable) {
            return available;
        } else {
            // Limit the number of bytes available to the number
            // of bytes remaining in the range.
            return (int)this.virtualAvailable;
        }
    }
Skip to the start location of the range of bytes desired by the user.
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/AdjustedRangeInputStream.java