isoos / buffer Goto Github PK
View Code? Open in Web Editor NEWDart library for byte buffers and streams.
License: BSD 3-Clause "New" or "Revised" License
Dart library for byte buffers and streams.
License: BSD 3-Clause "New" or "Revised" License
Null safety is now in beta. I would like to update my package to use null-safety, but I depend on this package.
Any ideas when you will upgrade? I'd be willing to submit a pull request. A quick check with dart migrate
seems to provide a decent migration, but I understand if you would like to spend a bit more time and not have as many null asserts.
There are cases when you need to peek
ahead for given data, e.g. check for magics and act accordingly.
I encountered this minor problem in a project that reads a p-string (length prefixed) string at the end of a datagram. In one case, the length of the string was 0 and the subsequent read(0) crashed.
Here's a test case that simulates the situation I ran into. Think of [0,0,0,0] as a datagram that contains just one empty p-string.
test('Zero byte read at end of buffer', () {
final buffer = [0,0,0,0];
final reader = ByteDataReader();
reader.add(buffer);
final strLen = reader.readUint32();
expect(strLen, equals(0));
var noBytes = reader.read(strLen);
expect(noBytes.length, equals(0));
});
The work-around is to only call read(n) when n>0, but it would be better if read(0) just returned an empty Uint8List.
P.S. Thanks for publishing this library!
Example page is missing in pub.dev
Example of a package with an Example page
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.