Skip to content

Twitter Decoder cannot handle all InputStream implementations #553

@pjfanning

Description

@pjfanning

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions