Class AwsChunkedEncodingInputStream

  • All Implemented Interfaces:
    com.amazonaws.internal.MetricAware, com.amazonaws.internal.Releasable, Closeable, AutoCloseable

    public final class AwsChunkedEncodingInputStream
    extends com.amazonaws.internal.SdkInputStream
    A wrapper class of InputStream that implements chunked-encoding.
    • Constructor Detail

      • AwsChunkedEncodingInputStream

        public AwsChunkedEncodingInputStream​(InputStream in,
                                             int maxBufferSize,
                                             byte[] kSigning,
                                             String datetime,
                                             String keyPath,
                                             String headerSignature,
                                             AWS4Signer aws4Signer)
        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.
        The default chunk size cannot be customized, since we need to calculate the expected encoded stream length before reading the wrapped stream.
        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.
        Parameters:
        in - The original InputStream.
        maxBufferSize - Maximum number of bytes buffered by this class.
        kSigning - Signing key.
        datetime - Datetime, as used in SigV4.
        keyPath - Keypath/Scope, as used in SigV4.
        headerSignature - The signature of the signed headers. This will be used for calculating the signature of the first chunk.
        aws4Signer - The AWS4Signer used for hashing and signing.
    • Method Detail

      • mark

        public void mark​(int readlimit)
        The readlimit parameter is ignored.
        Overrides:
        mark in class InputStream
      • reset

        public void reset()
                   throws IOException
        Reset the stream, either by resetting the wrapped stream or using the buffer created by this class.
        Overrides:
        reset in class InputStream
        Throws:
        IOException
      • calculateStreamContentLength

        public static long calculateStreamContentLength​(long originalLength)
      • getWrappedInputStream

        protected InputStream getWrappedInputStream()
        Description copied from class: com.amazonaws.internal.SdkInputStream
        Returns the underlying input stream, if any, from the subclass; or null if there is no underlying input stream.
        Specified by:
        getWrappedInputStream in class com.amazonaws.internal.SdkInputStream