private boolean readNextChunk()

in src/main/java/software/amazon/encryption/s3/internal/CipherInputStream.java [65:89]


    private boolean readNextChunk() throws IOException {
        if (currentPosition >= maxPosition) {
            // All buffered data has been read, let's get some more
            if (eofReached) {
                return false;
            }
            int retryCount = 0;
            int length;
            do {
                if (retryCount > MAX_RETRY_COUNT) {
                    throw new IOException("Exceeded maximum number of attempts to read next chunk of data");
                }
                length = nextChunk();
                // If outputBuffer != null, it means that data is being read off of the InputStream
                if (outputBuffer == null) {
                    retryCount++;
                }
            } while (length == 0);

            if (length == -1) {
                return false;
            }
        }
        return true;
    }