Class
OperationStream

Operational stream. Base class for cryptographic and compression streams.

Definition

Namespace:Telerik.Windows.Zip

Assembly:Telerik.Windows.Zip.dll

Syntax:

cs-api-definition
public abstract class OperationStream : Stream, IDisposable

Inheritance: objectMarshalByRefObjectStreamOperationStream

Derived Classes: CompressedStream

Implements: IDisposable

Inherited Members Stream.NullStream.CopyToAsync(Stream)Stream.CopyToAsync(Stream, int)Stream.CopyToAsync(Stream, int, CancellationToken)Stream.CopyTo(Stream)Stream.CopyTo(Stream, int)Stream.Close()Stream.Dispose()Stream.FlushAsync()Stream.FlushAsync(CancellationToken)Stream.CreateWaitHandle()Stream.BeginRead(byte[], int, int, AsyncCallback, object)Stream.EndRead(IAsyncResult)Stream.ReadAsync(byte[], int, int)Stream.ReadAsync(byte[], int, int, CancellationToken)Stream.BeginWrite(byte[], int, int, AsyncCallback, object)Stream.EndWrite(IAsyncResult)Stream.WriteAsync(byte[], int, int)Stream.WriteAsync(byte[], int, int, CancellationToken)Stream.ReadByte()Stream.WriteByte(byte)Stream.Synchronized(Stream)Stream.ObjectInvariant()Stream.CanTimeoutStream.ReadTimeoutStream.WriteTimeoutMarshalByRefObject.MemberwiseClone(bool)MarshalByRefObject.GetLifetimeService()MarshalByRefObject.InitializeLifetimeService()MarshalByRefObject.CreateObjRef(Type)

Properties

CanRead

Gets a value indicating whether the current stream supports reading.

Declaration

cs-api-definition
public override bool CanRead { get; }

Property Value

bool

Overrides Stream.CanRead

CanSeek

Gets a value indicating whether the current stream supports seeking.

Declaration

cs-api-definition
public override bool CanSeek { get; }

Property Value

bool

Overrides Stream.CanSeek

CanWrite

Gets a value indicating whether the current stream supports writing.

Declaration

cs-api-definition
public override bool CanWrite { get; }

Property Value

bool

Overrides Stream.CanWrite

HasFlushedFinalBlock

Gets a value which indicates whether the final buffer block has been written/read to/from the underlying stream.

Declaration

cs-api-definition
public bool HasFlushedFinalBlock { get; }

Property Value

bool

true if the final block has been flushed or end of underlying stream is reached; otherwise, false.

Length

Gets the length in bytes of the stream.

Declaration

cs-api-definition
public override long Length { get; }

Property Value

long

Overrides Stream.Length

Position

Gets or sets the position within the current stream.

Declaration

cs-api-definition
public override long Position { get; set; }

Property Value

long

Overrides Stream.Position

TotalPlainCount

Gets value which specify total plain bytes count (not-compressed and not-encrypted).

Declaration

cs-api-definition
public long TotalPlainCount { get; }

Property Value

long

TotalTransformedCount

Gets value which specify total transformed bytes count (compressed or encrypted).

Declaration

cs-api-definition
public long TotalTransformedCount { get; }

Property Value

long

Methods

Dispose(bool)

Releases the unmanaged resources used by the Stream and optionally releases the managed resources.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Usage", "CA2215:Dispose methods should call base class dispose")]
protected override void Dispose(bool disposing)

Parameters

disposing

bool

Value which indicates whether both managed and unmanaged resources (true) on only unmanaged resources (false) should be released.

Overrides Stream.Dispose(bool)

EnsureNotDisposed()

Ensure that current stream is not disposed.

Declaration

cs-api-definition
protected void EnsureNotDisposed()

Flush()

Clears all buffers for this stream and causes any buffered data to be written to the underlying device.

Declaration

cs-api-definition
public override void Flush()

Overrides Stream.Flush()

Read(byte[], int, int)

Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

Declaration

cs-api-definition
public override int Read(byte[] buffer, int offset, int count)

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.

Returns

int

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.

Exceptions

NotSupportedException

The StreamOperationMode associated with current OperationStream object does not match the underlying stream.
For example, this exception is thrown when using Read with an underlying stream that is write only.

ArgumentOutOfRangeException

The offset parameter is less than zero.-or- The count parameter is less than zero.

ArgumentException

The sum of the count and offset parameters is larger than the length of the buffer.

Overrides Stream.Read(byte[], int, int)

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

Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

Declaration

cs-api-definition
protected int Read(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 cancellation token used to cancel the operation

Returns

int

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.

Exceptions

NotSupportedException

The StreamOperationMode associated with current OperationStream object does not match the underlying stream.
For example, this exception is thrown when using Read with an underlying stream that is write only.

ArgumentOutOfRangeException

The offset parameter is less than zero.-or- The count parameter is less than zero.

ArgumentException

The sum of the count and offset parameters is larger than the length of the buffer.

Seek(long, SeekOrigin)

Sets the position within the current stream.

Declaration

cs-api-definition
public override long Seek(long offset, SeekOrigin origin)

Parameters

offset

long

A byte offset relative to the origin parameter.

origin

SeekOrigin

A value of type SeekOrigin indicating the reference point used to obtain the new position.

Returns

long

The new position within the current stream.

Overrides Stream.Seek(long, SeekOrigin)

SetLength(long)

Sets the length of the current stream.

Declaration

cs-api-definition
public override void SetLength(long value)

Parameters

value

long

The desired length of the current stream in bytes.

Overrides Stream.SetLength(long)

Write(byte[], int, int)

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

Declaration

cs-api-definition
public override void Write(byte[] buffer, int offset, int count)

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.

Overrides Stream.Write(byte[], int, int)

~OperationStream()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

Declaration

cs-api-definition
protected ~OperationStream()