Class IgnoreDisposeStream
Pass-through stream that ignores Dispose Useful for dealing with MemoryStreams that you want to re-use
public class IgnoreDisposeStream : Stream, IDisposable, IAsyncDisposable
- Inheritance
-
IgnoreDisposeStream
- Implements
- Inherited Members
Constructors
IgnoreDisposeStream(Stream)
Creates a new IgnoreDisposeStream
public IgnoreDisposeStream(Stream sourceStream)
Parameters
sourceStream
StreamThe source stream
Properties
CanRead
Can Read
public override bool CanRead { get; }
Property Value
CanSeek
Can Seek
public override bool CanSeek { get; }
Property Value
CanWrite
Can write to the underlying stream
public override bool CanWrite { get; }
Property Value
IgnoreDispose
If true the Dispose will be ignored, if false, will pass through to the SourceStream Set to true by default
public bool IgnoreDispose { get; set; }
Property Value
Length
Gets the length of the underlying stream
public override long Length { get; }
Property Value
Position
Gets or sets the position of the underlying stream
public override long Position { get; set; }
Property Value
SourceStream
The source stream all other methods fall through to
public Stream SourceStream { get; }
Property Value
Methods
Dispose(bool)
Dispose - by default (IgnoreDispose = true) will do nothing, leaving the underlying stream undisposed
protected override void Dispose(bool disposing)
Parameters
disposing
bool
Flush()
Flushes the underlying stream
public override void Flush()
Read(byte[], int, int)
Reads from the underlying stream
public override int Read(byte[] buffer, int offset, int count)
Parameters
Returns
Seek(long, SeekOrigin)
Seeks on the underlying stream
public override long Seek(long offset, SeekOrigin origin)
Parameters
offset
longorigin
SeekOrigin
Returns
SetLength(long)
Sets the length of the underlying stream
public override void SetLength(long value)
Parameters
value
long
Write(byte[], int, int)
Writes to the underlying stream
public override void Write(byte[] buffer, int offset, int count)