flip encode buffer

This commit is contained in:
Greg Wilkins 2014-06-10 13:05:28 +02:00
parent ab5461d73e
commit 19c4939ede
2 changed files with 14 additions and 3 deletions

View File

@ -93,9 +93,23 @@ public class HpackEncoder
ByteBuffer buffer = lease.acquire(8*1024,false); // TODO make size configurable
// TODO handle multiple buffers if large size configured.
BufferUtil.clearToFill(buffer);
encode(buffer,metadata);
BufferUtil.flipToFlush(buffer,0);
}
public void encodeMaxHeaderTableSize(ByteBuffer buffer, int maxHeaderTableSize)
{
// TODO
_context.resize(maxHeaderTableSize);
}
public void encodeClearReferenceSet(ByteBuffer buffer)
{
// TODO
_context.clearReferenceSet();
}
public void encode(ByteBuffer buffer, MetaData metadata)
{
// Add Request/response meta fields

View File

@ -52,7 +52,6 @@ public class HpackTest
BufferUtil.flipToFlush(buffer,0);
Response decoded0 = (Response)decoder.decode(buffer);
System.err.println(decoded0);
Assert.assertEquals(original0,decoded0);
// Same again?
@ -61,7 +60,6 @@ public class HpackTest
BufferUtil.flipToFlush(buffer,0);
Response decoded0b = (Response)decoder.decode(buffer);
System.err.println(decoded0b);
Assert.assertEquals(original0,decoded0b);
@ -78,7 +76,6 @@ public class HpackTest
BufferUtil.flipToFlush(buffer,0);
Response decoded1 = (Response)decoder.decode(buffer);
System.err.println(decoded1);
Assert.assertEquals(original1,decoded1);