|
| 1 | +# System.IO.Pipelines |
| 2 | + |
| 3 | +``` diff |
| 4 | ++namespace System.IO.Pipelines { |
| 5 | ++ public struct FlushResult { |
| 6 | ++ public FlushResult(bool isCanceled, bool isCompleted); |
| 7 | ++ public bool IsCanceled { get; } |
| 8 | ++ public bool IsCompleted { get; } |
| 9 | ++ } |
| 10 | ++ public interface IDuplexPipe { |
| 11 | ++ PipeReader Input { get; } |
| 12 | ++ PipeWriter Output { get; } |
| 13 | ++ } |
| 14 | ++ public sealed class Pipe { |
| 15 | ++ public Pipe(); |
| 16 | ++ public Pipe(PipeOptions options); |
| 17 | ++ public PipeReader Reader { get; } |
| 18 | ++ public PipeWriter Writer { get; } |
| 19 | ++ public void Reset(); |
| 20 | ++ } |
| 21 | ++ public class PipeOptions { |
| 22 | ++ public PipeOptions(MemoryPool<byte>? pool = null, PipeScheduler? readerScheduler = null, PipeScheduler? writerScheduler = null, long pauseWriterThreshold = (long)-1, long resumeWriterThreshold = (long)-1, int minimumSegmentSize = -1, bool useSynchronizationContext = true); |
| 23 | ++ public static PipeOptions Default { get; } |
| 24 | ++ public int MinimumSegmentSize { get; } |
| 25 | ++ public long PauseWriterThreshold { get; } |
| 26 | ++ public MemoryPool<byte> Pool { get; } |
| 27 | ++ public PipeScheduler ReaderScheduler { get; } |
| 28 | ++ public long ResumeWriterThreshold { get; } |
| 29 | ++ public bool UseSynchronizationContext { get; } |
| 30 | ++ public PipeScheduler WriterScheduler { get; } |
| 31 | ++ } |
| 32 | ++ public abstract class PipeReader { |
| 33 | ++ protected PipeReader(); |
| 34 | ++ public abstract void AdvanceTo(SequencePosition consumed); |
| 35 | ++ public abstract void AdvanceTo(SequencePosition consumed, SequencePosition examined); |
| 36 | ++ public virtual Stream AsStream(bool leaveOpen = false); |
| 37 | ++ public abstract void CancelPendingRead(); |
| 38 | ++ public abstract void Complete(Exception? exception = null); |
| 39 | ++ public virtual ValueTask CompleteAsync(Exception? exception = null); |
| 40 | ++ public virtual Task CopyToAsync(PipeWriter destination, CancellationToken cancellationToken = default(CancellationToken)); |
| 41 | ++ public virtual Task CopyToAsync(Stream destination, CancellationToken cancellationToken = default(CancellationToken)); |
| 42 | ++ public static PipeReader Create(ReadOnlySequence<byte> sequence); |
| 43 | ++ public static PipeReader Create(Stream stream, StreamPipeReaderOptions? readerOptions = null); |
| 44 | ++ public virtual void OnWriterCompleted(Action<Exception?, object?> callback, object? state); |
| 45 | ++ public abstract ValueTask<ReadResult> ReadAsync(CancellationToken cancellationToken = default(CancellationToken)); |
| 46 | ++ public ValueTask<ReadResult> ReadAtLeastAsync(int minimumSize, CancellationToken cancellationToken = default(CancellationToken)); |
| 47 | ++ protected virtual ValueTask<ReadResult> ReadAtLeastAsyncCore(int minimumSize, CancellationToken cancellationToken); |
| 48 | ++ public abstract bool TryRead(out ReadResult result); |
| 49 | ++ } |
| 50 | ++ public abstract class PipeScheduler { |
| 51 | ++ protected PipeScheduler(); |
| 52 | ++ public static PipeScheduler Inline { get; } |
| 53 | ++ public static PipeScheduler ThreadPool { get; } |
| 54 | ++ public abstract void Schedule(Action<object?> action, object? state); |
| 55 | ++ } |
| 56 | ++ public abstract class PipeWriter : IBufferWriter<byte> { |
| 57 | ++ protected PipeWriter(); |
| 58 | ++ public virtual bool CanGetUnflushedBytes { get; } |
| 59 | ++ public virtual long UnflushedBytes { get; } |
| 60 | ++ public abstract void Advance(int bytes); |
| 61 | ++ public virtual Stream AsStream(bool leaveOpen = false); |
| 62 | ++ public abstract void CancelPendingFlush(); |
| 63 | ++ public abstract void Complete(Exception? exception = null); |
| 64 | ++ public virtual ValueTask CompleteAsync(Exception? exception = null); |
| 65 | ++ protected internal virtual Task CopyFromAsync(Stream source, CancellationToken cancellationToken = default(CancellationToken)); |
| 66 | ++ public static PipeWriter Create(Stream stream, StreamPipeWriterOptions? writerOptions = null); |
| 67 | ++ public abstract ValueTask<FlushResult> FlushAsync(CancellationToken cancellationToken = default(CancellationToken)); |
| 68 | ++ public abstract Memory<byte> GetMemory(int sizeHint = 0); |
| 69 | ++ public abstract Span<byte> GetSpan(int sizeHint = 0); |
| 70 | ++ public virtual void OnReaderCompleted(Action<Exception?, object?> callback, object? state); |
| 71 | ++ public virtual ValueTask<FlushResult> WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken)); |
| 72 | ++ } |
| 73 | ++ public readonly struct ReadResult { |
| 74 | ++ public ReadResult(ReadOnlySequence<byte> buffer, bool isCanceled, bool isCompleted); |
| 75 | ++ public ReadOnlySequence<byte> Buffer { get; } |
| 76 | ++ public bool IsCanceled { get; } |
| 77 | ++ public bool IsCompleted { get; } |
| 78 | ++ } |
| 79 | ++ public static class StreamPipeExtensions { |
| 80 | ++ public static Task CopyToAsync(this Stream source, PipeWriter destination, CancellationToken cancellationToken = default(CancellationToken)); |
| 81 | ++ } |
| 82 | ++ public class StreamPipeReaderOptions { |
| 83 | ++ public StreamPipeReaderOptions(MemoryPool<byte>? pool, int bufferSize, int minimumReadSize, bool leaveOpen); |
| 84 | ++ public StreamPipeReaderOptions(MemoryPool<byte>? pool = null, int bufferSize = -1, int minimumReadSize = -1, bool leaveOpen = false, bool useZeroByteReads = false); |
| 85 | ++ public int BufferSize { get; } |
| 86 | ++ public bool LeaveOpen { get; } |
| 87 | ++ public int MinimumReadSize { get; } |
| 88 | ++ public MemoryPool<byte> Pool { get; } |
| 89 | ++ public bool UseZeroByteReads { get; } |
| 90 | ++ } |
| 91 | ++ public class StreamPipeWriterOptions { |
| 92 | ++ public StreamPipeWriterOptions(MemoryPool<byte>? pool = null, int minimumBufferSize = -1, bool leaveOpen = false); |
| 93 | ++ public bool LeaveOpen { get; } |
| 94 | ++ public int MinimumBufferSize { get; } |
| 95 | ++ public MemoryPool<byte> Pool { get; } |
| 96 | ++ } |
| 97 | ++} |
| 98 | +``` |
| 99 | + |
0 commit comments