Class ChunkedUploadWrapperStream
Stream wrapper that double-buffers from a wrapped stream and returns the buffered content as a series of signed 'chunks' for the AWS4 ('Signature V4') protocol or the asymmetric Sigv4 (Sigv4a) protocol.
public class ChunkedUploadWrapperStream : WrapperStream, IDisposable, IAsyncDisposable
  - Inheritance
 - 
      
      
      
      
      ChunkedUploadWrapperStream
 
- Implements
 
- Inherited Members
 
Constructors
ChunkedUploadWrapperStream(Stream, int, AWSSigningResultBase, CoreChecksumAlgorithm, IDictionary<string, string>)
Initializes a chunked upload stream with one or more trailing headers, which may include a trailing checksum header
public ChunkedUploadWrapperStream(Stream stream, int wrappedStreamBufferSize, AWSSigningResultBase headerSigningResult, CoreChecksumAlgorithm trailingChecksum, IDictionary<string, string> trailingHeaders)
  Parameters
streamStreamStream to wrap
wrappedStreamBufferSizeintSize of buffer used for reading from stream
headerSigningResultAWSSigningResultBaseSigV4 or SigV4a signing result for the request's headers
trailingChecksumCoreChecksumAlgorithmAlgorithm to use to calculate the stream's checksum
trailingHeadersIDictionary<string, string>Trailing headers to append after the wrapped stream
Fields
DefaultChunkSize
public static readonly int DefaultChunkSize
  Field Value
V4A_SIGNATURE_LENGTH
public const int V4A_SIGNATURE_LENGTH = 144
  Field Value
V4_SIGNATURE_LENGTH
public const int V4_SIGNATURE_LENGTH = 64
  Field Value
Properties
CanSeek
Gets a value indicating whether the current stream supports seeking. True if the stream supports seeking; otherwise, false.
public override bool CanSeek { get; }
  Property Value
Length
Length override to return the true length of the payload plus the metainfo supplied with each chunk
public override long Length { get; }
  Property Value
Methods
BuildChunkedStringToSign(string, string, string, string, int, byte[])
Builds the string to sign for a single V4/V4a chunk
public static string BuildChunkedStringToSign(string prefix, string dateTime, string scope, string previousSignature, int dataLength, byte[] inputBuffer)
  Parameters
prefixstringAlgorithm being used
dateTimestringISO8601DateTime that we're signing the request for
scopestringSigning scope (date/region/service/aws4_request)
previousSignaturestringPrevious chunk's unpadded signature
dataLengthintLength of the content for this chunk
inputBufferbyte[]Content of this chunk
Returns
- string
 The string to sign for this chunk
ComputeChunkedContentLength(long, int)
Computes the total size of the data payload, including the chunk metadata. Called externally so as to be able to set the correct Content-Length header value.
public static long ComputeChunkedContentLength(long originalLength, int signatureLength)
  Parameters
originalLengthlongLength of the wrapped stream
signatureLengthintLength of the signature for each chunk, in bytes
Returns
- long
 Total size of the wrapped payload, in bytes
ComputeChunkedContentLength(long, int, IDictionary<string, string>, CoreChecksumAlgorithm)
Computes the total size of the data payload, including the chunk metadata and optional trailing headers. Called externally so as to be able to set the correct Content-Length header value.
public static long ComputeChunkedContentLength(long originalLength, int signatureLength, IDictionary<string, string> trailingHeaders, CoreChecksumAlgorithm trailingChecksum)
  Parameters
originalLengthlongLength of the wrapped stream
signatureLengthintLength of the signature for each chunk, in bytes
trailingHeadersIDictionary<string, string>Optional trailing headers
trailingChecksumCoreChecksumAlgorithmOptional checksum algorithm for a trailing header
Returns
- long
 Total size of the wrapped payload, in bytes
Read(byte[], int, int)
Reads some or all of the processed chunk to the consumer, constructing and streaming a new chunk if more input data is available.
public override int Read(byte[] buffer, int offset, int count)
  Parameters
Returns
ReadAsync(byte[], int, int, CancellationToken)
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
  Parameters
bufferbyte[]offsetintcountintcancellationTokenCancellationToken