in src/main/java/com/twitter/http2/HttpHeaderBlockDecoder.java [50:72]
public void decode(ByteBuf headerBlock, final HttpHeaderBlockFrame frame) throws IOException {
HeaderListener headerListener = NULL_HEADER_LISTENER;
if (frame != null) {
headerListener = new HeaderListenerImpl(frame.headers());
}
if (cumulation == null) {
decoder.decode(new ByteBufInputStream(headerBlock), headerListener);
if (headerBlock.isReadable()) {
cumulation = Unpooled.buffer(headerBlock.readableBytes());
cumulation.writeBytes(headerBlock);
}
} else {
cumulation.writeBytes(headerBlock);
decoder.decode(new ByteBufInputStream(cumulation), headerListener);
if (cumulation.isReadable()) {
cumulation.discardReadBytes();
} else {
cumulation.release();
cumulation = null;
}
}
}