@Override
    public int read(byte[] b, int off, int len) throws IOException {
        int readLen = super.read(b, off, len);
        dataLength += readLen >= 0 ? readLen : 0;
        checkLength(readLen == -1);
        return readLen;
    }
{@inheritDoc}

@throws SdkClientException
            if the data length read has exceeded the expected total, or
            if the total data length is not the same as the expected
            total.
aws-java-sdk-core/src/main/java/com/amazonaws/util/LengthCheckInputStream.java