Giter Site home page Giter Site logo

support 24bit numbers about okio HOT 5 OPEN

square avatar square commented on May 23, 2024
support 24bit numbers

from okio.

Comments (5)

JakeWharton avatar JakeWharton commented on May 23, 2024

I would not call this size number a medium.
On Sep 7, 2014 12:26 PM, "Adrian Cole" [email protected] wrote:

Conceding this is an uncommon use case, http2 has a 24bit unsigned length
field. It feel cleaner if okhttp could ask okio to read/writeMedium.

https://tools.ietf.org/html/draft-ietf-httpbis-http2-14#section-4.1


Reply to this email directly or view it on GitHub
#74.

from okio.

JakeWharton avatar JakeWharton commented on May 23, 2024

Since there's no native type at this size and the use case is small I'm
leaning toward not having this as a first-party API.

The alternative for consumers is a convenience method which does a
readFully on a byte[3](or require%283%29 and 3x readByte) and converts to an
int, right?
On Sep 7, 2014 3:49 PM, "Jake Wharton" [email protected] wrote:

I would not call this size number a medium.
On Sep 7, 2014 12:26 PM, "Adrian Cole" [email protected] wrote:

Conceding this is an uncommon use case, http2 has a 24bit unsigned length
field. It feel cleaner if okhttp could ask okio to read/writeMedium.

https://tools.ietf.org/html/draft-ietf-httpbis-http2-14#section-4.1


Reply to this email directly or view it on GitHub
#74.

from okio.

codefromthecrypt avatar codefromthecrypt commented on May 23, 2024

yeah I don't know a good name. Just netty calls it medium.
http://netty.io/4.0/api/io/netty/buffer/ByteBuf.html#readMedium()

from okio.

JakeWharton avatar JakeWharton commented on May 23, 2024

Oh, nice.
On Sep 7, 2014 4:09 PM, "Adrian Cole" [email protected] wrote:

yeah I don't know a good name. Just netty calls it medium.
http://netty.io/4.0/api/io/netty/buffer/ByteBuf.html#readMedium()


Reply to this email directly or view it on GitHub
#74 (comment).

from okio.

codefromthecrypt avatar codefromthecrypt commented on May 23, 2024

I have to admit that I don't regularly encounter 24-bit numbers. Then
again, I haven't written a lot of binary protocol or encoding stuff either.
Quick googling suggests http/2 (frame length) and BLE (CRC) are the hottest
users of 24-bit numbers these days. http/2 has changed minds often, so
maybe 24-bit ain't forever there.. So, I can see an argument against adding
medium or similarly named.

If we don't, then yeah I think we can make a utility which requires 3 then
reads the bytes and shifts them into an int.

from okio.

Related Issues (20)

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.