@Override
    public long skip(long n) throws IOException {
        if (n <= 0) {
            return 0;
        }
        long remaining = n;
        int toskip = (int) Math.min(DEFAULT_BUFFER_SIZE, n);
        byte[] temp = new byte[toskip];
        while (remaining > 0) {
            int count;
            if ( (count = read(temp, 0, toskip)) < 0) {
                break;
            }
            remaining -= count;
        }
        return n - remaining;
    }
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