Table of Contents

Class StreamWrapper

Namespace
Yarhl.IO.StreamFormat
Assembly
Yarhl.dll

Wrapper over a streams to override easily specific methods and use the base implementation for the rest.

public abstract class StreamWrapper : Stream, IAsyncDisposable, IDisposable
Inheritance
StreamWrapper
Implements
Derived
Inherited Members

Constructors

StreamWrapper(Stream)

Initializes a new instance of the StreamWrapper class.

protected StreamWrapper(Stream stream)

Parameters

stream Stream

The stream to wrap.

Properties

BaseStream

Gets or sets the base stream.

public Stream BaseStream { get; protected set; }

Property Value

Stream

CanRead

Gets a value indicating whether the current stream supports reading.

public override bool CanRead { get; }

Property Value

bool

CanSeek

Gets a value indicating whether the current stream supports seeking.

public override bool CanSeek { get; }

Property Value

bool

CanTimeout

Gets a value indicating whether the current stream supports timeouts.

public override bool CanTimeout { get; }

Property Value

bool

CanWrite

Gets a value indicating whether the current stream supports writing.

public override bool CanWrite { get; }

Property Value

bool

Disposed

Gets a value indicating whether this stream has been disposed.

public bool Disposed { get; }

Property Value

bool

Length

Gets the length of this stream.

public override long Length { get; }

Property Value

long

Position

Gets or sets the position from the start of this stream.

public override long Position { get; set; }

Property Value

long

Methods

Dispose(bool)

Releases all resource used by the StreamWrapper object.

protected override void Dispose(bool disposing)

Parameters

disposing bool

If set to true free managed resources also.

Flush()

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

public override void Flush()

Read(byte[], int, int)

Reads from the stream to the buffer.

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

Parameters

buffer byte[]

Buffer to copy data.

offset int

Index to start copying in buffer.

count int

Number of bytes to read.

Returns

int

The number of bytes read.

ReadByte()

Reads the next byte.

public override int ReadByte()

Returns

int

The next byte.

Seek(long, SeekOrigin)

Move the position of the stream.

public override long Seek(long offset, SeekOrigin origin)

Parameters

offset long

Distance to move position.

origin SeekOrigin

Mode to move position.

Returns

long

The new position of the stream.

SetLength(long)

Sets the length of the stream.

public override void SetLength(long value)

Parameters

value long

The new length of the stream.

Write(byte[], int, int)

Writes the a portion of the buffer to the stream.

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

Parameters

buffer byte[]

Buffer to write.

offset int

Index in the buffer.

count int

Bytes to write.

WriteByte(byte)

Writes a byte.

public override void WriteByte(byte value)

Parameters

value byte

Byte value.