Amazon.Runtime.Internal.Util.ChunkedUploadWrapperStream.Read C# (CSharp) Метод

Read() публичный Метод

Reads some or all of the processed chunk to the consumer, constructing and streaming a new chunk if more input data is available.
public Read ( byte buffer, int offset, int count ) : int
buffer byte
offset int
count int
Результат int
        public override int Read(byte[] buffer, int offset, int count)
        {
            // if we've no output and it was the special termination chunk,
            // we're done otherwise fill the input buffer with enough data
            // for the next chunk (or with whatever is left) and construct
            // the chunk in the output buffer ready for streaming
            if (_outputBufferPos == -1)
            {
                if (_wrappedStreamConsumed && _outputBufferIsTerminatingChunk)
                    return 0;

                var bytesRead = FillInputBuffer();
                ConstructOutputBufferChunk(bytesRead);
                _outputBufferIsTerminatingChunk = (_wrappedStreamConsumed && bytesRead == 0);
            }

            var outputRemaining = _outputBufferDataLen - _outputBufferPos;
            if (outputRemaining < count)
                count = outputRemaining;

            Buffer.BlockCopy(_outputBuffer, _outputBufferPos, buffer, offset, count);
            _outputBufferPos += count;
            if (_outputBufferPos >= _outputBufferDataLen)
                _outputBufferPos = -1;

            return count;
        }