@@ -46,30 +46,16 @@ public KaitaiAsyncStream(byte[] bytes) : this(new MemoryStream(bytes))
4646
4747 #region Stream positioning
4848
49- /// <summary>
50- /// Check if the stream position is at the end of the stream
51- /// </summary>
5249 public override bool IsEof => BaseStream . Position >= BaseStream . Length && _bitsLeft == 0 ;
5350
54- /// <summary>
55- /// Seek to a specific position from the beginning of the stream
56- /// </summary>
57- /// <param name="position">The position to seek to</param>
58- /// <remarks>.NET Stream API does not support SeekAsync, therefore, consumer needs to define his own implementation.</remarks>
5951 public virtual Task SeekAsync ( long position )
6052 {
6153 BaseStream . Seek ( position , SeekOrigin . Begin ) ;
6254 return Task . CompletedTask ;
6355 }
6456
65- /// <summary>
66- /// Get the current position in the stream
67- /// </summary>
6857 public override long Pos => BaseStream . Position ;
6958
70- /// <summary>
71- /// Get the total length of the stream (ie. file size)
72- /// </summary>
7359 public override long Size => BaseStream . Length ;
7460
7561 #endregion
@@ -78,52 +64,24 @@ public virtual Task SeekAsync(long position)
7864
7965 #region Signed
8066
81- /// <summary>
82- /// Read a signed byte from the stream
83- /// </summary>
84- /// <returns></returns>
8567 public async Task < sbyte > ReadS1Async ( ) => await AsyncBinaryReader . ReadSByteAsync ( ) ;
8668
8769 #region Big-endian
8870
89- /// <summary>
90- /// Read a signed short from the stream (big endian)
91- /// </summary>
92- /// <returns></returns>
9371 public async Task < short > ReadS2beAsync ( ) => BitConverter . ToInt16 ( await ReadBytesNormalisedBigEndianAsync ( 2 ) , 0 ) ;
9472
95- /// <summary>
96- /// Read a signed int from the stream (big endian)
97- /// </summary>
98- /// <returns></returns>
9973 public async Task < int > ReadS4beAsync ( ) => BitConverter . ToInt32 ( await ReadBytesNormalisedBigEndianAsync ( 4 ) , 0 ) ;
10074
101- /// <summary>
102- /// Read a signed long from the stream (big endian)
103- /// </summary>
104- /// <returns></returns>
10575 public async Task < long > ReadS8beAsync ( ) => BitConverter . ToInt64 ( await ReadBytesNormalisedBigEndianAsync ( 8 ) , 0 ) ;
10676
10777 #endregion
10878
10979 #region Little-endian
11080
111- /// <summary>
112- /// Read a signed short from the stream (little endian)
113- /// </summary>
114- /// <returns></returns>
11581 public async Task < short > ReadS2leAsync ( ) => BitConverter . ToInt16 ( await ReadBytesNormalisedLittleEndianAsync ( 2 ) , 0 ) ;
11682
117- /// <summary>
118- /// Read a signed int from the stream (little endian)
119- /// </summary>
120- /// <returns></returns>
12183 public async Task < int > ReadS4leAsync ( ) => BitConverter . ToInt32 ( await ReadBytesNormalisedLittleEndianAsync ( 4 ) , 0 ) ;
12284
123- /// <summary>
124- /// Read a signed long from the stream (little endian)
125- /// </summary>
126- /// <returns></returns>
12785 public async Task < long > ReadS8leAsync ( ) => BitConverter . ToInt64 ( await ReadBytesNormalisedLittleEndianAsync ( 8 ) , 0 ) ;
12886
12987 #endregion
@@ -132,52 +90,24 @@ public virtual Task SeekAsync(long position)
13290
13391 #region Unsigned
13492
135- /// <summary>
136- /// Read an unsigned byte from the stream
137- /// </summary>
138- /// <returns></returns>
13993 public async Task < byte > ReadU1Async ( ) => await AsyncBinaryReader . ReadByteAsync ( ) ;
14094
14195 #region Big-endian
14296
143- /// <summary>
144- /// Read an unsigned short from the stream (big endian)
145- /// </summary>
146- /// <returns></returns>
14797 public async Task < ushort > ReadU2beAsync ( ) => BitConverter . ToUInt16 ( await ReadBytesNormalisedBigEndianAsync ( 2 ) , 0 ) ;
14898
149- /// <summary>
150- /// Read an unsigned int from the stream (big endian)
151- /// </summary>
152- /// <returns></returns>
15399 public async Task < uint > ReadU4beAsync ( ) => BitConverter . ToUInt32 ( await ReadBytesNormalisedBigEndianAsync ( 4 ) , 0 ) ;
154100
155- /// <summary>
156- /// Read an unsigned long from the stream (big endian)
157- /// </summary>
158- /// <returns></returns>
159101 public async Task < ulong > ReadU8beAsync ( ) => BitConverter . ToUInt64 ( await ReadBytesNormalisedBigEndianAsync ( 8 ) , 0 ) ;
160102
161103 #endregion
162104
163105 #region Little-endian
164106
165- /// <summary>
166- /// Read an unsigned short from the stream (little endian)
167- /// </summary>
168- /// <returns></returns>
169107 public async Task < ushort > ReadU2leAsync ( ) => BitConverter . ToUInt16 ( await ReadBytesNormalisedLittleEndianAsync ( 2 ) , 0 ) ;
170108
171- /// <summary>
172- /// Read an unsigned int from the stream (little endian)
173- /// </summary>
174- /// <returns></returns>
175109 public async Task < uint > ReadU4leAsync ( ) => BitConverter . ToUInt32 ( await ReadBytesNormalisedLittleEndianAsync ( 4 ) , 0 ) ;
176110
177- /// <summary>
178- /// Read an unsigned long from the stream (little endian)
179- /// </summary>
180- /// <returns></returns>
181111 public async Task < ulong > ReadU8leAsync ( ) => BitConverter . ToUInt64 ( await ReadBytesNormalisedLittleEndianAsync ( 8 ) , 0 ) ;
182112
183113 #endregion
@@ -190,32 +120,16 @@ public virtual Task SeekAsync(long position)
190120
191121 #region Big-endian
192122
193- /// <summary>
194- /// Read a single-precision floating point value from the stream (big endian)
195- /// </summary>
196- /// <returns></returns>
197123 public async Task < float > ReadF4beAsync ( ) => BitConverter . ToSingle ( await ReadBytesNormalisedBigEndianAsync ( 4 ) , 0 ) ;
198124
199- /// <summary>
200- /// Read a double-precision floating point value from the stream (big endian)
201- /// </summary>
202- /// <returns></returns>
203125 public async Task < double > ReadF8beAsync ( ) => BitConverter . ToDouble ( await ReadBytesNormalisedBigEndianAsync ( 8 ) , 0 ) ;
204126
205127 #endregion
206128
207129 #region Little-endian
208130
209- /// <summary>
210- /// Read a single-precision floating point value from the stream (little endian)
211- /// </summary>
212- /// <returns></returns>
213131 public async Task < float > ReadF4leAsync ( ) => BitConverter . ToSingle ( await ReadBytesNormalisedLittleEndianAsync ( 4 ) , 0 ) ;
214132
215- /// <summary>
216- /// Read a double-precision floating point value from the stream (little endian)
217- /// </summary>
218- /// <returns></returns>
219133 public async Task < double > ReadF8leAsync ( ) => BitConverter . ToDouble ( await ReadBytesNormalisedLittleEndianAsync ( 8 ) , 0 ) ;
220134
221135 #endregion
@@ -300,11 +214,6 @@ public async Task<ulong> ReadBitsIntLeAsync(int n)
300214
301215 #region Byte arrays
302216
303- /// <summary>
304- /// Read a fixed number of bytes from the stream
305- /// </summary>
306- /// <param name="count">The number of bytes to read</param>
307- /// <returns></returns>
308217 public async Task < byte [ ] > ReadBytesAsync ( long count )
309218 {
310219 if ( count < 0 || count > Int32 . MaxValue )
@@ -315,11 +224,6 @@ public async Task<byte[]> ReadBytesAsync(long count)
315224 return bytes ;
316225 }
317226
318- /// <summary>
319- /// Read a fixed number of bytes from the stream
320- /// </summary>
321- /// <param name="count">The number of bytes to read</param>
322- /// <returns></returns>
323227 public async Task < byte [ ] > ReadBytesAsync ( ulong count )
324228 {
325229 if ( count > Int32 . MaxValue )
0 commit comments