|
| 1 | +# Specialized .NET Stream classes |
| 2 | + |
| 3 | +*Enhanced streams for communication in-proc or across the Internet.* |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +1. [`SimplexStream`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/SimplexStream.md) is meant to allow two parties to communicate *one direction*. |
| 8 | + Anything written to the stream can subsequently be read from it. You can share this `Stream` |
| 9 | + with any two parties (in the same AppDomain) and one can send messages to the other. |
| 10 | +1. [`FullDuplexStream`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/FullDuplexStream.md) creates a pair of bidirectional streams for |
| 11 | + in-proc two-way communication; it also creates a single bidirectional stream from two |
| 12 | + unidirectional streams. |
| 13 | +1. [`MultiplexingStream`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/MultiplexingStream.md) allows you to split any bidirectional |
| 14 | + .NET Stream into many sub-streams (called channels). This allows two parties to establish |
| 15 | + just one transport stream (e.g. named pipe or web socket) and use it for many independent |
| 16 | + protocols. For example, one might set up JSON-RPC on one channel and use other channels for |
| 17 | + efficient binary transfers. |
| 18 | +1. [`AsStream()`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/AsStream.md) wraps a `WebSocket`, `System.IO.Pipelines.PipeReader`, |
| 19 | + `System.IO.Pipelines.PipeWriter`, or `System.IO.Pipelines.IDuplexPipe` with a |
| 20 | + `System.IO.Stream` for reading and/or writing. |
| 21 | +1. [`UsePipe()`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/UsePipe.md) enables reading from |
| 22 | + and writing to a `Stream` or `WebSocket` using the `PipeReader` and `PipeWriter` APIs. |
| 23 | +1. [`Stream.ReadSlice(long)`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/ReadSlice.md) creates a sub-stream that ends after |
| 24 | + a given number of bytes. |
| 25 | +1. [`PipeReader.ReadSlice(long)`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/ReadSlice.md) creates a sub-`PipeReader` that ends after |
| 26 | + a given number of bytes. |
| 27 | +1. [`MonitoringStream`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/MonitoringStream.md) wraps another Stream and raises events for |
| 28 | + all I/O calls so you can monitor and/or trace the data as it goes by. |
| 29 | +1. [`WriteSubstream` and `ReadSubstream`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/Substream.md) allow you to serialize data of |
| 30 | + an unknown length as part of a larger stream, and later deserialize it such in reading the |
| 31 | + substream, you cannot read more bytes than were written to it. |
| 32 | +1. [`Sequence<T>`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/Sequence.md) is a builder for `ReadOnlySequence<T>`. |
| 33 | +1. [`PrefixingBufferWriter<T>`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/PrefixingBufferWriter.md) wraps another `IBufferWriter<T>` |
| 34 | + to allow for prefixing some header to the next written buffer, which may be arbitrarily long. |
| 35 | +1. [`BufferTextWriter`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/BufferTextWriter.md) is a `TextWriter`-derived type that can |
| 36 | + write directly to any `IBufferWriter<byte>`, making it more reusable than `StreamWriter` |
| 37 | + and thus allows for alloc-free writing across many writers. |
| 38 | +1. [`SequenceTextReader`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/SequenceTextReader.md) is a `TextReader`-derived type that can |
| 39 | + read directly from any `ReadOnlySequence<byte>`, making it more reusable than `StreamReader` |
| 40 | + and thus allows for alloc-free reading across many sequences. |
| 41 | +1. [`DuplexPipe`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/DuplexPipe.md) is a trivial implementation of `IDuplexPipe`. |
| 42 | +1. [`Stream.ReadBlockAsync`](https://github.com/dotnet/Nerdbank.Streams/blob/main/doc/ReadBlockAsync.md) guarantees to fill the supplied buffer except under certain documented conditions, instead of the regular `ReadAsync` guarantee of supplying at least 1 byte. |
0 commit comments