@Override
    public int read() throws IOException {
        byte[] tmp = new byte[1];
        int count = read(tmp, 0, 1);
        if (count != -1) {
            if (log.isDebugEnabled())
                log.debug("One byte read from the stream.");
            int unsignedByte = (int) tmp[0] & 0xFF;
            return unsignedByte;
        } else {
            return count;
        }
    }
A wrapper of InputStream that implements pseudo-chunked-encoding.
Each chunk will be buffered for the calculation of the chunk signature
which is added at the head of each chunk.<br>
The default chunk size cannot be customized, since we need to calculate
the expected encoded stream length before reading the wrapped stream.<br>
This class will use the mark() & reset() of the wrapped InputStream if they
are supported, otherwise it will create a buffer for bytes read from
the wrapped stream.
@param in
            The original InputStream.
@param maxBufferSize
            Maximum number of bytes buffered by this class.
@param kSigning
            Signing key.
@param datetime
            Datetime, as used in SigV4.
@param keyPath
            Keypath/Scope, as used in SigV4.
@param headerSignature
            The signature of the signed headers. This will be used for
            calculating the signature of the first chunk.
@param aws4Signer
            The AWS4Signer used for hashing and signing.
aws-java-sdk-s3/src/main/java/com/amazonaws/auth/AwsChunkedEncodingInputStream.java