Class PipeStream
PipeStream is a thread-safe read/write data stream for use between two threads in a single-producer/single-consumer type problem.
public class PipeStream : Stream, IDisposable, IAsyncDisposable
- Inheritance
-
PipeStream
- Implements
- Inherited Members
Constructors
PipeStream()
public PipeStream()
Properties
CanRead
Gets a value indicating whether the current stream supports reading.
public override bool CanRead { get; }
Property Value
Remarks
It is safe to read from PipeStream even after disposal.
CanSeek
Gets a value indicating whether the current stream supports seeking.
public override bool CanSeek { get; }
Property Value
CanWrite
Gets a value indicating whether the current stream supports writing.
public override bool CanWrite { get; }
Property Value
- bool
true if this stream has not been disposed and the underlying channel is still open, otherwise false.
Remarks
A value of true does not necessarily mean a write will succeed. It is possible that the stream is disposed by another thread between a call to CanWrite and the call to write.
Length
Gets the number of bytes currently available for reading.
public override long Length { get; }
Property Value
- long
A long value representing the length of the stream in bytes.
Position
This property always returns 0, and throws NotSupportedException when calling the setter.
public override long Position { get; set; }
Property Value
Exceptions
- NotSupportedException
The setter is called.
Methods
Dispose(bool)
protected override void Dispose(bool disposing)
Parameters
disposing
bool
Flush()
This method does nothing.
public override void Flush()
Read(byte[], int, int)
public override int Read(byte[] buffer, int offset, int count)
Parameters
Returns
Seek(long, SeekOrigin)
This method always throws NotSupportedException.
public override long Seek(long offset, SeekOrigin origin)
Parameters
offset
longA byte offset relative to the
origin
parameter.origin
SeekOriginA value of type SeekOrigin indicating the reference point used to obtain the new position.
Returns
- long
Never.
Exceptions
- NotSupportedException
Always.
SetLength(long)
This method always throws NotSupportedException.
public override void SetLength(long value)
Parameters
value
longThe desired length of the current stream in bytes.
Exceptions
- NotSupportedException
Always.
Write(byte[], int, int)
public override void Write(byte[] buffer, int offset, int count)