Table of Contents

Class PartialWrapperStream

Namespace
Amazon.Runtime.Internal.Util
Assembly
AWSSDK.Core.dll

This class is used to wrap a stream for a particular segment of a stream. It makes that segment look like you are reading from beginning to end of the stream.

public class PartialWrapperStream : WrapperStream, IDisposable, IAsyncDisposable
Inheritance
PartialWrapperStream
Implements
Inherited Members

Constructors

PartialWrapperStream(Stream, long)

public PartialWrapperStream(Stream stream, long partSize)

Parameters

stream Stream
partSize long

Properties

Length

Gets the length in bytes of the stream.

public override long Length { get; }

Property Value

long

Position

Gets or sets the position within the current stream.

public override long Position { get; set; }

Property Value

long

Methods

Read(byte[], int, int)

public override int Read(byte[] buffer, int offset, int count)

Parameters

buffer byte[]
offset int
count int

Returns

int

ReadAsync(byte[], int, int, CancellationToken)

Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.

public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)

Parameters

buffer byte[]

An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.

offset int

The zero-based byte offset in buffer at which to begin storing the data read from the current stream.

count int

The maximum number of bytes to be read from the current stream.

cancellationToken CancellationToken

The token to monitor for cancellation requests. The default value is System.Threading.CancellationToken.None.

Returns

Task<int>

A task that represents the asynchronous read operation. The value of the TResult parameter contains the total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.

Seek(long, SeekOrigin)

public override long Seek(long offset, SeekOrigin origin)

Parameters

offset long
origin SeekOrigin

Returns

long

SetLength(long)

public override void SetLength(long value)

Parameters

value long

Write(byte[], int, int)

public override void Write(byte[] buffer, int offset, int count)

Parameters

buffer byte[]
offset int
count int

WriteAsync(byte[], int, int, CancellationToken)

Asynchronously writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)

Parameters

buffer byte[]

An array of bytes. This method copies count bytes from buffer to the current stream.

offset int

The zero-based byte offset in buffer at which to begin copying bytes to the current stream.

count int

The number of bytes to be written to the current stream.

cancellationToken CancellationToken

The token to monitor for cancellation requests. The default value is System.Threading.CancellationToken.None.

Returns

Task

A task that represents the asynchronous write operation.

WriteByte(byte)

public override void WriteByte(byte value)

Parameters

value byte