Class AutoResetStream
Decorates a Stream instance to support auto-rewind after read/write access.
Inheritance
AutoResetStream
Assembly: BionicCode.Utilities.Net.Common.dll
Syntax
public class AutoResetStream : Stream, IDisposable
Constructors
|
Improve this Doc
View Source
AutoResetStream()
Declaration
|
Improve this Doc
View Source
AutoResetStream(Stream)
Constructor which accepts the Stream instance to decorate in order to extend its behavior.
Declaration
public AutoResetStream(Stream baseStream)
Parameters
| Type |
Name |
Description |
| Stream |
baseStream |
The Stream instance to decorate in order to extend its behavior.
|
|
Improve this Doc
View Source
AutoResetStream(Stream, Boolean)
Constructor which accepts the Stream instance to decorate in order to extend its behavior.
Declaration
public AutoResetStream(Stream baseStream, bool leaveDecoratedStreamOpen)
Parameters
| Type |
Name |
Description |
| Stream |
baseStream |
The Stream instance to decorate in order to extend its behavior.
|
| Boolean |
leaveDecoratedStreamOpen |
When set to true the decorated underlying Stream will be disposed or closed too, if the AutoResetStream is disposed or closed.
|
|
Improve this Doc
View Source
AutoResetStream(Stream, SeekOrigin, Boolean)
Constructor which accepts the Stream instance to decorate in order to extend its behavior.
Declaration
public AutoResetStream(Stream baseStream, SeekOrigin resetOrigin, bool leaveDecoratedStreamOpen)
Parameters
| Type |
Name |
Description |
| Stream |
baseStream |
The Stream instance to decorate in order to extend its behavior.
|
| SeekOrigin |
resetOrigin |
The origin to which the stream should be reset to.
|
| Boolean |
leaveDecoratedStreamOpen |
When set to true the decorated underlying Stream will be disposed or closed too, if the AutoResetStream is disposed or closed.
|
Properties
|
Improve this Doc
View Source
BaseStream
The decorated Stream instance which will be extended.
Declaration
public Stream BaseStream { get; set; }
Property Value
| Type |
Description |
| Stream |
An instance of type Stream. This instance will be decorated to extend the default Stream features and behaviors.
|
|
Improve this Doc
View Source
CanRead
Declaration
public override bool CanRead { get; }
Property Value
Overrides
|
Improve this Doc
View Source
CanSeek
Declaration
public override bool CanSeek { get; }
Property Value
Overrides
|
Improve this Doc
View Source
CanTimeout
Declaration
public override bool CanTimeout { get; }
Property Value
Overrides
|
Improve this Doc
View Source
CanWrite
Declaration
public override bool CanWrite { get; }
Property Value
Overrides
|
Improve this Doc
View Source
IsDisposingDecoratedStream
Gets whether the decorated underlying Stream will be closed or disposed when the AutoResetStream instance is closed or disposed. Use constructor to set the value in order to configure the behavior.
Declaration
public bool IsDisposingDecoratedStream { get; }
Property Value
|
Improve this Doc
View Source
Length
Declaration
public override long Length { get; }
Property Value
Overrides
|
Improve this Doc
View Source
Position
Declaration
public override long Position { get; set; }
Property Value
Overrides
|
Improve this Doc
View Source
ReadTimeout
Declaration
public override int ReadTimeout { get; set; }
Property Value
Overrides
|
Improve this Doc
View Source
ResetOrigin
Defines the position to which the stream should reset to.
Declaration
public SeekOrigin ResetOrigin { get; set; }
Property Value
|
Improve this Doc
View Source
WriteTimeout
Declaration
public override int WriteTimeout { get; set; }
Property Value
Overrides
Methods
|
Improve this Doc
View Source
Close()
Declaration
public override void Close()
Overrides
|
Improve this Doc
View Source
CopyToAsync(Stream, Int32, CancellationToken)
Declaration
public override async Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
Parameters
Returns
Overrides
|
Improve this Doc
View Source
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type |
Name |
Description |
| Boolean |
disposing |
|
Overrides
|
Improve this Doc
View Source
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| Object |
obj |
|
Returns
Overrides
|
Improve this Doc
View Source
Flush()
Declaration
public override void Flush()
Overrides
|
Improve this Doc
View Source
FlushAsync(CancellationToken)
Declaration
public override Task FlushAsync(CancellationToken cancellationToken)
Parameters
Returns
Overrides
|
Improve this Doc
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
|
Improve this Doc
View Source
Read(Byte[], Int32, Int32)
Declaration
public override int Read(byte[] buffer, int offset, int count)
Parameters
Returns
Overrides
|
Improve this Doc
View Source
ReadAsync(Byte[], Int32, Int32, CancellationToken)
Declaration
public override async Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Parameters
Returns
Overrides
|
Improve this Doc
View Source
ReadByte()
Declaration
public override int ReadByte()
Returns
Overrides
|
Improve this Doc
View Source
Reset(SeekOrigin)
Resets the Position to an offset of '0' relative to the provided seekOrigin.
Declaration
public void Reset(SeekOrigin seekOrigin = SeekOrigin.Current)
Parameters
| Type |
Name |
Description |
| SeekOrigin |
seekOrigin |
The optional relative position of the Stream to apply the zero offset to. The default is Begin.
|
|
Improve this Doc
View Source
Seek(Int64, SeekOrigin)
Declaration
public override long Seek(long offset, SeekOrigin origin)
Parameters
Returns
Overrides
|
Improve this Doc
View Source
SetLength(Int64)
Declaration
public override void SetLength(long value)
Parameters
| Type |
Name |
Description |
| Int64 |
value |
|
Overrides
|
Improve this Doc
View Source
ToString()
Declaration
public override string ToString()
Returns
Overrides
|
Improve this Doc
View Source
Write(Byte[], Int32, Int32)
Declaration
public override void Write(byte[] buffer, int offset, int count)
Parameters
Overrides
|
Improve this Doc
View Source
WriteAsync(Byte[], Int32, Int32, CancellationToken)
Declaration
public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Parameters
Returns
Overrides
|
Improve this Doc
View Source
WriteByte(Byte)
Declaration
public override void WriteByte(byte value)
Parameters
| Type |
Name |
Description |
| Byte |
value |
|
Overrides
Implements
Extension Methods