Git Product home page Git Product logo

buffer's People

Contributors

adrianboyko avatar isoos avatar jonasfj avatar timwhiting avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

buffer's Issues

Null Safety Migration

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.

Add support for `peek`.

There are cases when you need to peek ahead for given data, e.g. check for magics and act accordingly.

Reading zero bytes from end of buffer crashes.

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.