Specialized .NET Stream classes
Enhanced streams for communication in-proc or across the Internet.
SimplexStreamis meant to allow two parties to communicate one direction. Anything written to the stream can subsequently be read from it. You can share this
Streamwith any two parties (in the same AppDomain) and one can send messages to the other.
FullDuplexStreamcreates a pair of bidirectional streams for in-proc two-way communication; it also creates a single bidirectional stream from two unidirectional streams.
MultiplexingStreamallows you to split any bidirectional .NET Stream into many sub-streams (called channels). This allows two parties to establish just one transport stream (e.g. named pipe or web socket) and use it for many independent protocols. For example, one might set up JSON-RPC on one channel and use other channels for efficient binary transfers.
System.IO.Streamfor reading and/or writing.
UsePipe()enables reading from and writing to a
Stream.ReadSlice(long)creates a sub-stream that ends after a given number of bytes.
PipeReader.ReadSlice(long)creates a sub-
PipeReaderthat ends after a given number of bytes.
MonitoringStreamwraps another Stream and raises events for all I/O calls so you can monitor and/or trace the data as it goes by.
ReadSubstreamallow you to serialize data of an unknown length as part of a larger stream, and later deserialize it such in reading the substream, you cannot read more bytes than were written to it.
Sequence<T>is a builder for
IBufferWriter<T>to allow for prefixing some header to the next written buffer, which may be arbitrarily long.
TextWriter-derived type that can write directly to any
IBufferWriter<byte>, making it more reusable than
StreamWriterand thus allows for alloc-free writing across many writers.
TextReader-derived type that can read directly from any
ReadOnlySequence<byte>, making it more reusable than
StreamReaderand thus allows for alloc-free reading across many sequences.
DuplexPipeis a trivial implementation of