Interface ICustomStreamReader
This concrete implemetation of interface acts as the source stream for CopyStream class.
Namespace: StreamExtended.Network
Assembly: StreamExtended.dll
Syntax
public interface ICustomStreamReader
Properties
Available
Declaration
int Available { get; }
Property Value
Type | Description |
---|---|
Int32 |
BufferSize
Declaration
int BufferSize { get; }
Property Value
Type | Description |
---|---|
Int32 |
DataAvailable
Declaration
bool DataAvailable { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
FillBufferAsync(CancellationToken)
Fills the buffer asynchronous.
Declaration
Task<bool> FillBufferAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Boolean> |
PeekByteAsync(Int32, CancellationToken)
Peeks a byte asynchronous.
Declaration
Task<int> PeekByteAsync(int index, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<Int32> |
PeekByteFromBuffer(Int32)
Peeks a byte from buffer.
Declaration
byte PeekByteFromBuffer(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
Returns
Type | Description |
---|---|
Byte |
Exceptions
Type | Condition |
---|---|
Exception | Index is out of buffer size |
PeekBytesAsync(Int32, Int32, CancellationToken)
Peeks bytes asynchronous.
Declaration
Task<byte[]> PeekBytesAsync(int index, int size, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index. |
Int32 | size | |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<Byte[]> |
Read(Byte[], Int32, Int32)
When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
Declaration
int Read(byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | An array of bytes. When this method returns, the buffer contains the specified byte array with the values between |
Int32 | offset | The zero-based byte offset in |
Int32 | count | The maximum number of bytes to be read from the current stream. |
Returns
Type | Description |
---|---|
Int32 | The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached. |
ReadAsync(Byte[], Int32, Int32, CancellationToken)
Read the specified number (or less) of raw bytes from the base stream to the given buffer to the specified offset
Declaration
Task<int> ReadAsync(byte[] buffer, int offset, int bytesToRead, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | |
Int32 | offset | |
Int32 | bytesToRead | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Int32> | The number of bytes read |
ReadByteFromBuffer()
Declaration
byte ReadByteFromBuffer()
Returns
Type | Description |
---|---|
Byte |
ReadLineAsync(CancellationToken)
Read a line from the byte stream
Declaration
Task<string> ReadLineAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<String> |