Class ReadOnlyWrapperStream
Wrapper stream that only supports reading
public class ReadOnlyWrapperStream : WrapperStream, IDisposable, IAsyncDisposable
- Inheritance
-
ReadOnlyWrapperStream
- Implements
- Derived
- Inherited Members
Constructors
ReadOnlyWrapperStream(Stream)
public ReadOnlyWrapperStream(Stream baseStream)
Parameters
baseStream
Stream
Properties
CanRead
Gets a value indicating whether the current stream supports reading. True if the stream supports reading; otherwise, false.
public override bool CanRead { get; }
Property Value
CanSeek
Gets a value indicating whether the current stream supports seeking. True if the stream supports seeking; otherwise, false.
public override bool CanSeek { get; }
Property Value
CanWrite
Gets a value indicating whether the current stream supports writing. True if the stream supports writing; otherwise, false.
public override bool CanWrite { get; }
Property Value
Length
Gets the length in bytes of the stream.
public override long Length { get; }
Property Value
Position
Gets or sets the position within the current stream.
public override long Position { get; set; }
Property Value
Methods
Flush()
Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
public override void Flush()
FlushAsync(CancellationToken)
Asynchronously clears all buffers for this stream and causes any buffered data to be written to the underlying device.
public override Task FlushAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenThe token to monitor for cancellation requests. The default value is System.Threading.CancellationToken.None.
Returns
- Task
A task that represents the asynchronous flush operation.
Seek(long, SeekOrigin)
public override long Seek(long offset, SeekOrigin origin)
Parameters
offset
longorigin
SeekOrigin
Returns
SetLength(long)
public override void SetLength(long value)
Parameters
value
long
Write(byte[], int, int)
public override void Write(byte[] buffer, int offset, int count)
Parameters
WriteAsync(byte[], int, int, CancellationToken)
Asynchronously writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Parameters
buffer
byte[]An array of bytes. This method copies count bytes from buffer to the current stream.
offset
intThe zero-based byte offset in buffer at which to begin copying bytes to the current stream.
count
intThe number of bytes to be written to the current stream.
cancellationToken
CancellationTokenThe token to monitor for cancellation requests. The default value is System.Threading.CancellationToken.None.
Returns
- Task
A task that represents the asynchronous write operation.