Skip to content

Binary input stream truncated #159

Closed
@m0mus

Description

@m0mus

I am trying to use binary input stream for my rest calls but the input stream get's truncated once first FF byte is encountered.

The reason is following part of PublisherInputStream class:

    public int read() throws IOException {
...
               ByteBuffer currentBuffer = chunk != null && !chunk.isReleased() ? chunk.data() : null;
...               
                if (currentBuffer != null && currentBuffer.remaining() > 0) {
                    return currentBuffer.get();
                }
...

Here the FF byte is returned directly as int (== -1) which for input stream is interpreted as the end of stream.
The return currentBuffer.get(); line should be changed to currentBuffer.get() & 0xFF to return correct values.

Reported by Eva Krejcirova

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions