Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DelegatedStream.cs
Go to the documentation of this file.
1using System.IO;
4
5namespace System.Net;
6
7internal abstract class DelegatedStream : Stream
8{
9 private readonly Stream _stream;
10
12
13 public override bool CanRead => _stream.CanRead;
14
15 public override bool CanSeek => _stream.CanSeek;
16
17 public override bool CanWrite => _stream.CanWrite;
18
19 public override long Length
20 {
21 get
22 {
23 if (!CanSeek)
24 {
26 }
27 return _stream.Length;
28 }
29 }
30
31 public override long Position
32 {
33 get
34 {
35 if (!CanSeek)
36 {
38 }
39 return _stream.Position;
40 }
41 set
42 {
43 if (!CanSeek)
44 {
46 }
47 _stream.Position = value;
48 }
49 }
50
52 {
53 if (stream == null)
54 {
55 throw new ArgumentNullException("stream");
56 }
58 }
59
60 public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
61 {
62 if (!CanRead)
63 {
65 }
66 return _stream.BeginRead(buffer, offset, count, callback, state);
67 }
68
69 public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
70 {
71 if (!CanWrite)
72 {
74 }
75 return _stream.BeginWrite(buffer, offset, count, callback, state);
76 }
77
78 public override void Close()
79 {
80 _stream.Close();
81 }
82
83 public override int EndRead(IAsyncResult asyncResult)
84 {
85 if (!CanRead)
86 {
88 }
90 }
91
92 public override void EndWrite(IAsyncResult asyncResult)
93 {
94 if (!CanWrite)
95 {
97 }
99 }
100
101 public override void Flush()
102 {
103 _stream.Flush();
104 }
105
110
111 public override int Read(byte[] buffer, int offset, int count)
112 {
113 if (!CanRead)
114 {
116 }
117 return _stream.Read(buffer, offset, count);
118 }
119
121 {
122 if (!CanRead)
123 {
125 }
127 }
128
137
138 public override long Seek(long offset, SeekOrigin origin)
139 {
140 if (!CanSeek)
141 {
143 }
144 return _stream.Seek(offset, origin);
145 }
146
147 public override void SetLength(long value)
148 {
149 if (!CanSeek)
150 {
152 }
154 }
155
156 public override void Write(byte[] buffer, int offset, int count)
157 {
158 if (!CanWrite)
159 {
161 }
163 }
164
166 {
167 if (!CanWrite)
168 {
170 }
172 }
173
182}
Task FlushAsync()
Definition Stream.cs:669
void SetLength(long value)
long Seek(long offset, SeekOrigin origin)
virtual void Close()
Definition Stream.cs:644
Task WriteAsync(byte[] buffer, int offset, int count)
Definition Stream.cs:914
virtual void EndWrite(IAsyncResult asyncResult)
Definition Stream.cs:889
int Read(byte[] buffer, int offset, int count)
Task< int > ReadAsync(byte[] buffer, int offset, int count)
Definition Stream.cs:762
void Write(byte[] buffer, int offset, int count)
virtual IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state)
Definition Stream.cs:688
virtual IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state)
Definition Stream.cs:813
virtual int EndRead(IAsyncResult asyncResult)
Definition Stream.cs:737
override ValueTask WriteAsync(ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken=default(CancellationToken))
override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
override void Write(byte[] buffer, int offset, int count)
override void SetLength(long value)
override void EndWrite(IAsyncResult asyncResult)
override Task FlushAsync(CancellationToken cancellationToken)
override int EndRead(IAsyncResult asyncResult)
override long Seek(long offset, SeekOrigin origin)
override int Read(byte[] buffer, int offset, int count)
override ValueTask< int > ReadAsync(Memory< byte > buffer, CancellationToken cancellationToken=default(CancellationToken))
override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
override Task< int > ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
static string SeekNotSupported
Definition SR.cs:142
static string WriteNotSupported
Definition SR.cs:146
static string ReadNotSupported
Definition SR.cs:144
Definition SR.cs:7