Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
HttpBaseStream.cs
Go to the documentation of this file.
1using System.IO;
5
6namespace System.Net.Http;
7
8internal abstract class HttpBaseStream : Stream
9{
10 public sealed override bool CanSeek => false;
11
12 public sealed override long Length
13 {
14 get
15 {
16 throw new NotSupportedException();
17 }
18 }
19
20 public sealed override long Position
21 {
22 get
23 {
24 throw new NotSupportedException();
25 }
26 set
27 {
28 throw new NotSupportedException();
29 }
30 }
31
32 public sealed override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
33 {
35 }
36
37 public sealed override int EndRead(IAsyncResult asyncResult)
38 {
40 }
41
42 public sealed override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
43 {
45 }
46
47 public sealed override void EndWrite(IAsyncResult asyncResult)
48 {
50 }
51
52 public sealed override long Seek(long offset, SeekOrigin origin)
53 {
54 throw new NotSupportedException();
55 }
56
57 public sealed override void SetLength(long value)
58 {
59 throw new NotSupportedException();
60 }
61
62 public sealed override int ReadByte()
63 {
64 byte reference = 0;
65 if (Read(MemoryMarshal.CreateSpan(ref reference, 1)) != 1)
66 {
67 return -1;
68 }
69 return reference;
70 }
71
72 public sealed override int Read(byte[] buffer, int offset, int count)
73 {
75 return Read(buffer.AsSpan(offset, count));
76 }
77
83
84 public override void Write(byte[] buffer, int offset, int count)
85 {
87 }
88
89 public sealed override void WriteByte(byte value)
90 {
91 Write(MemoryMarshal.CreateReadOnlySpan(ref value, 1));
92 }
93
99
100 public override void Flush()
101 {
102 FlushAsync(default(CancellationToken)).GetAwaiter().GetResult();
103 }
104
109
111 {
112 if (!cancellationToken.IsCancellationRequested)
113 {
114 return Task.CompletedTask;
115 }
117 }
118
119 public abstract override int Read(Span<byte> buffer);
120
122
124}
Task FlushAsync()
Definition Stream.cs:669
static void ValidateBufferArguments(byte[] buffer, int offset, int count)
Definition Stream.cs:1044
override int Read(byte[] buffer, int offset, int count)
override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
override long Seek(long offset, SeekOrigin origin)
override void EndWrite(IAsyncResult asyncResult)
override int Read(Span< byte > buffer)
override ValueTask< int > ReadAsync(Memory< byte > buffer, CancellationToken cancellationToken)
override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
override int EndRead(IAsyncResult asyncResult)
override void WriteByte(byte value)
static Task NopAsync(CancellationToken cancellationToken)
override void Write(byte[] buffer, int offset, int count)
override ValueTask WriteAsync(ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken)
override void SetLength(long value)
override Task< int > ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
override Task FlushAsync(CancellationToken cancellationToken)
static IAsyncResult Begin(Task task, AsyncCallback callback, object state)
Definition TaskToApm.cs:43
static void End(IAsyncResult asyncResult)
Definition TaskToApm.cs:48
static Task FromCanceled(CancellationToken cancellationToken)
Definition Task.cs:3363
static Task CompletedTask
Definition Task.cs:1120
new TaskAwaiter< TResult > GetAwaiter()
Definition Task.cs:221