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
StreamThe stream to wrap.
Properties
BaseStream
Gets or sets the base stream.
public Stream BaseStream { get; protected set; }
Property Value
CanRead
Gets a value indicating whether the current stream supports reading.
public override bool CanRead { get; }
Property Value
CanSeek
Gets a value indicating whether the current stream supports seeking.
public override bool CanSeek { get; }
Property Value
CanTimeout
Gets a value indicating whether the current stream supports timeouts.
public override bool CanTimeout { get; }
Property Value
CanWrite
Gets a value indicating whether the current stream supports writing.
public override bool CanWrite { get; }
Property Value
Disposed
Gets a value indicating whether this stream has been disposed.
public bool Disposed { get; }
Property Value
Length
Gets the length of this stream.
public override long Length { get; }
Property Value
Position
Gets or sets the position from the start of this stream.
public override long Position { get; set; }
Property Value
Methods
Dispose(bool)
Releases all resource used by the StreamWrapper object.
protected override void Dispose(bool disposing)
Parameters
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
intIndex to start copying in buffer.
count
intNumber 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
longDistance to move position.
origin
SeekOriginMode 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
longThe 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
WriteByte(byte)
Writes a byte.
public override void WriteByte(byte value)
Parameters
value
byteByte value.