Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RequestStream.cs
Go to the documentation of this file.
1using System.IO;
4
5namespace System.Net;
6
7internal sealed class RequestStream : Stream
8{
9 private readonly MemoryStream _buffer = new MemoryStream();
10
11 public override bool CanRead => false;
12
13 public override bool CanSeek => false;
14
15 public override bool CanWrite => true;
16
17 public override long Length
18 {
19 get
20 {
21 throw new NotSupportedException();
22 }
23 }
24
25 public override long Position
26 {
27 get
28 {
29 throw new NotSupportedException();
30 }
31 set
32 {
33 throw new NotSupportedException();
34 }
35 }
36
37 public override void Flush()
38 {
39 }
40
42 {
43 if (!cancellationToken.IsCancellationRequested)
44 {
45 return Task.CompletedTask;
46 }
48 }
49
50 public override int Read(byte[] buffer, int offset, int count)
51 {
52 throw new NotSupportedException();
53 }
54
55 public override long Seek(long offset, SeekOrigin origin)
56 {
57 throw new NotSupportedException();
58 }
59
60 public override void SetLength(long value)
61 {
62 throw new NotSupportedException();
63 }
64
65 public override void Write(byte[] buffer, int offset, int count)
66 {
69 }
70
76
81
82 public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
83 {
85 return _buffer.BeginWrite(buffer, offset, count, asyncCallback, asyncState);
86 }
87
88 public override void EndWrite(IAsyncResult asyncResult)
89 {
91 }
92
94 {
96 bool flag = _buffer.TryGetBuffer(out buffer);
97 return buffer;
98 }
99}
virtual bool TryGetBuffer(out ArraySegment< byte > buffer)
override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
override void Write(byte[] buffer, int offset, int count)
static void ValidateBufferArguments(byte[] buffer, int offset, int count)
Definition Stream.cs:1044
virtual void EndWrite(IAsyncResult asyncResult)
Definition Stream.cs:889
virtual IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state)
Definition Stream.cs:813
override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
override long Seek(long offset, SeekOrigin origin)
override int Read(byte[] buffer, int offset, int count)
override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
override ValueTask WriteAsync(ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken=default(CancellationToken))
override void EndWrite(IAsyncResult asyncResult)
override void Write(byte[] buffer, int offset, int count)
override Task FlushAsync(CancellationToken cancellationToken)
ArraySegment< byte > GetBuffer()
readonly MemoryStream _buffer
override void SetLength(long value)
static Task FromCanceled(CancellationToken cancellationToken)
Definition Task.cs:3363
static Task CompletedTask
Definition Task.cs:1120