Class StreamContainer

StreamContainer class

Represents stream container which contains the stream and provides stream processing routines.

public class StreamContainer : DisposableObject

Constructors

NameDescription
StreamContainer(Stream)Initializes a new instance of the StreamContainer class.
StreamContainer(Stream, bool)Initializes a new instance of the StreamContainer class.

Properties

NameDescription
virtual CanRead { get; }Gets a value indicating whether stream supports reading.
virtual CanSeek { get; }Gets a value indicating whether stream supports seeking.
virtual CanWrite { get; }Gets a value indicating whether stream supports writing.
Disposed { get; }Gets a value indicating whether this instance is disposed.
virtual IsStreamDisposedOnClose { get; }Gets a value indicating whether this stream is disposed on close.
virtual Length { get; set; }Gets or sets the stream length in bytes. This value is less than the Length by the starting stream position passed in the StreamContainer constructor.
virtual Position { get; set; }Gets or sets the current position within the stream. This value represents offset from the starting stream position passed in the StreamContainer constructor.
virtual Stream { get; }Gets the data stream.
SyncRoot { get; }Gets an object that can be used to synchronize access to the synchronized resource.

Methods

NameDescription
Dispose()Disposes the current instance.
virtual Flush()Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
virtual Read(byte[])Reads bytes to fill the specified bytes buffer.
virtual 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.
virtual ReadByte()Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
virtual Save(Stream)Saves (copies) the stream’s data to the specified stream. Uses default buffer size ReadWriteBytesCount and stream Length value.
virtual Save(string)Saves (copies) the stream’s data to the specified stream. Uses default buffer size ReadWriteBytesCount and stream Length value.
virtual Save(Stream, int)Saves (copies) all the stream’s data to the specified stream. Uses stream Length value.
virtual Save(string, int)Saves (copies) the stream’s data to the specified stream. Uses stream Length value.
virtual Save(Stream, int, long)Saves (copies) the stream’s data to the specified stream.
virtual Save(string, int, long)Saves (copies) the stream’s data to the specified stream.
virtual Seek(long, SeekOrigin)Sets the position within the current stream.
virtual SeekBegin()Sets the stream position to the beginning of the stream. This value represents offset from the starting stream position passed in the StreamContainer constructor.
virtual ToBytes()Converts the stream data to the Byte array.
virtual ToBytes(long, long)Converts the stream data to the Byte array.
virtual Write(byte[])Writes all of the specified bytes to the stream.
virtual 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.
virtual WriteByte(byte)Writes a byte to the current position in the stream and advances the position within the stream by one byte.
virtual WriteTo(StreamContainer)Copies the contained data to another StreamContainer.
virtual WriteTo(StreamContainer, long)Copies the contained data to another StreamContainer.
explicit operatorPerforms an explicit conversion from StreamContainer to Stream.

Fields

NameDescription
const ReadWriteBytesCountSpecifies read and write bytes count when reading sequentially.

See Also