Class AwsSignedChunkedEncodingInputStream

All Implemented Interfaces:
Closeable, AutoCloseable, Releasable

public final class AwsSignedChunkedEncodingInputStream extends AwsChunkedEncodingInputStream
A wrapper of InputStream that implements chunked encoding.

Each chunk will be buffered for the calculation of the chunk signature which is added at the head of each chunk. The request signature and the chunk signatures will be assumed to be hex-encoded strings.

This class will use the mark() invalid input: '&' reset() of the wrapped InputStream if they are supported, otherwise it will create a buffer for bytes read from the wrapped stream.

  • Method Details

    • builder

    • calculateStreamContentLength

      public static long calculateStreamContentLength(long originalLength, int signatureLength, AwsChunkedEncodingConfig config)
    • calculateStreamContentLength

      public static long calculateStreamContentLength(long originalLength, int signatureLength, AwsChunkedEncodingConfig config, boolean isTrailingChecksumCalculated)
      Calculates the expected total length of signed payload chunked stream.
      Parameters:
      originalLength - The length of the data
      signatureLength - The length of a calculated signature, dependent on which AwsChunkSigner is used
      config - The chunked encoding config determines the size of the chunks. Use the same values as when initializing the stream.
    • calculateChecksumContentLength

      public static int calculateChecksumContentLength(Algorithm algorithm, String headerName, int signatureLength)
    • reset

      public void reset() throws IOException
      Description copied from class: AwsChunkedEncodingInputStream
      Reset the stream, either by resetting the wrapped stream or using the buffer created by this class.
      Overrides:
      reset in class AwsChunkedEncodingInputStream
      Throws:
      IOException