File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1+ ## 2.2.1
2+
3+ - Add ` mustRead ` .
4+
15## 2.2.0
26
37- Remove undocumented binary reader.
Original file line number Diff line number Diff line change @@ -22,4 +22,14 @@ abstract class RandomAccessSource {
2222
2323 /// Closes the source.
2424 Future <void > close ();
25+
26+ /// Reads a specific number of bytes, ensuring that the exact number is read.
27+ /// Throws an exception if the number of bytes read is not equal to [length] .
28+ Future <Uint8List > mustRead (int length) async {
29+ final bytes = await read (length);
30+ if (bytes.length != length) {
31+ throw Exception ('Failed to read $length bytes, got ${bytes .length }' );
32+ }
33+ return bytes;
34+ }
2535}
Original file line number Diff line number Diff line change 11name : random_access_source
22description : A shared interface for common random access data.
3- version : 2.2.0
3+ version : 2.2.1
44repository : https://github.com/flutter-cavalry/random_access_source
55
66environment :
You can’t perform that action at this time.
0 commit comments