Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitter Decoder cannot handle all InputStream implementations #553

Open
pjfanning opened this issue May 11, 2024 · 1 comment
Open

Twitter Decoder cannot handle all InputStream implementations #553

pjfanning opened this issue May 11, 2024 · 1 comment

Comments

@pjfanning
Copy link
Contributor

See twitter/hpack#43

Works fine with ByteArrayInputStream but breaks if you use SequenceInputStream.

It is unlikely that the twitter/hpack issue will be fixed.

We could modify our fork of the HPack Decoder to avoid using available() method by

  • adding private methods boolean isEndOfStream() and byte nextByte()
    • one implementation is to read one byte ahead
    • read into a byte array and keep track of the pos and remaining bytes and refresh the byte array when remaining is zero
  • find an InputStream implementation that we can use to wrap the provided stream but that gives us a way to work out if we are at the end of the stream without consuming bytes
@jrudolph
Copy link
Contributor

jrudolph commented May 12, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants