Class CopyStream
Copies the source stream to destination stream.
But this let users to peek and read the copying process.
Assembly: StreamExtended.dll
Syntax
public class CopyStream : ICustomStreamReader, IDisposable
Constructors
|
Edit this page
View Source
CopyStream(ICustomStreamReader, ICustomStreamWriter, IBufferPool, int)
Declaration
public CopyStream(ICustomStreamReader reader, ICustomStreamWriter writer, IBufferPool bufferPool, int bufferSize)
Parameters
Properties
|
Edit this page
View Source
Available
Declaration
public int Available { get; }
Property Value
|
Edit this page
View Source
BufferSize
Declaration
public int BufferSize { get; }
Property Value
|
Edit this page
View Source
DataAvailable
Declaration
public bool DataAvailable { get; }
Property Value
|
Edit this page
View Source
ReadBytes
Declaration
public long ReadBytes { get; }
Property Value
Methods
|
Edit this page
View Source
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
|
Edit this page
View Source
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type |
Name |
Description |
| bool |
disposing |
|
|
Edit this page
View Source
FillBufferAsync(CancellationToken)
Fills the buffer asynchronous.
Declaration
public Task<bool> FillBufferAsync(CancellationToken cancellationToken = default)
Parameters
Returns
|
Edit this page
View Source
Flush()
Declaration
|
Edit this page
View Source
FlushAsync(CancellationToken)
Declaration
public Task FlushAsync(CancellationToken cancellationToken = default)
Parameters
Returns
|
Edit this page
View Source
PeekByteAsync(int, CancellationToken)
Peeks a byte asynchronous.
Declaration
public Task<int> PeekByteAsync(int index, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| int |
index |
The index.
|
| CancellationToken |
cancellationToken |
The cancellation token.
|
Returns
|
Edit this page
View Source
PeekByteFromBuffer(int)
Peeks a byte from buffer.
Declaration
public byte PeekByteFromBuffer(int index)
Parameters
| Type |
Name |
Description |
| int |
index |
The index.
|
Returns
Exceptions
| Type |
Condition |
| Exception |
Index is out of buffer size
|
|
Edit this page
View Source
PeekBytesAsync(int, int, CancellationToken)
Peeks bytes asynchronous.
Declaration
public Task<byte[]?> PeekBytesAsync(int index, int size, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| int |
index |
The index.
|
| int |
size |
The number of bytes to peek.
|
| CancellationToken |
cancellationToken |
The cancellation token.
|
Returns
|
Edit this page
View Source
Read(byte[], int, int)
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
public 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 offset and (offset + count - 1) replaced by the bytes read from the current source.
|
| int |
offset |
The zero-based byte offset in buffer at which to begin storing the data read from the current stream.
|
| int |
count |
The maximum number of bytes to be read from the current stream.
|
Returns
| Type |
Description |
| int |
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.
|
|
Edit this page
View Source
ReadAsync(byte[], int, int, CancellationToken)
Read the specified number (or less) of raw bytes from the base stream to the given buffer to the specified offset
Declaration
public Task<int> ReadAsync(byte[] buffer, int offset, int bytesToRead, CancellationToken cancellationToken = default)
Parameters
Returns
| Type |
Description |
| Task<int> |
The number of bytes read
|
|
Edit this page
View Source
ReadByteFromBuffer()
Declaration
public byte ReadByteFromBuffer()
Returns
|
Edit this page
View Source
ReadLineAsync(CancellationToken)
Read a line from the byte stream
Declaration
public Task<string?> ReadLineAsync(CancellationToken cancellationToken = default)
Parameters
Returns
Implements