ByteAccumulator transferTo expects buffer in fill mode.
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
7bcae9968b
commit
6e9572215b
|
@ -72,6 +72,9 @@ public class ByteAccumulator implements AutoCloseable
|
|||
|
||||
public void transferTo(ByteBuffer buffer)
|
||||
{
|
||||
// For some reason this method expects the buffer in fill mode but returns a buffer in flush mode.
|
||||
BufferUtil.flipToFlush(buffer, 0);
|
||||
|
||||
int availableSpace = BufferUtil.space(buffer);
|
||||
if (availableSpace < length)
|
||||
{
|
||||
|
|
|
@ -162,6 +162,7 @@ public abstract class CompressExtension extends AbstractExtension
|
|||
ByteBuffer buffer = getBufferPool().acquire(accumulator.getLength(), false);
|
||||
try
|
||||
{
|
||||
BufferUtil.clearToFill(buffer);
|
||||
accumulator.transferTo(buffer);
|
||||
newFrame.setPayload(buffer);
|
||||
nextIncomingFrame(newFrame);
|
||||
|
|
Loading…
Reference in New Issue