internal ChunkedUploadWrapperStream(Stream stream, int wrappedStreamBufferSize, AWS4SigningResult headerSigningResult)
: base(stream)
{
HeaderSigningResult = headerSigningResult;
PreviousChunkSignature = headerSigningResult.Signature;
_wrappedStreamBufferSize = wrappedStreamBufferSize;
_inputBuffer = new byte[DefaultChunkSize];
_outputBuffer = new byte[CalculateChunkHeaderLength(DefaultChunkSize)]; // header+data
#if BCL || CORECLR
// if the wrapped stream implements encryption, switch to a read-and-copy
// strategy for filling the chunk buffer
var encryptionStream = SearchWrappedStream(s =>
{
var encryptUploadPartStream = s as EncryptUploadPartStream;
if (encryptUploadPartStream != null)
return true;
var encryptStream = s as EncryptStream;
return encryptStream != null;
});
if (encryptionStream != null)
_readStrategy = ReadStrategy.ReadAndCopy;
#endif
}