in http2/src/main/java/org/apache/mina/http2/impl/Http2FrameHeadePartialDecoder.java [85:108]
public boolean consume(ByteBuffer buffer) {
while (buffer.hasRemaining() && state != State.END) {
if (decoder.consume(buffer)) {
switch (state) {
case LENGTH:
value.setLength(((IntPartialDecoder)decoder).getValue().intValue());
decoder = new BytePartialDecoder(2);
state = State.TYPE_FLAGS;
break;
case TYPE_FLAGS:
value.setType(((BytePartialDecoder)decoder).getValue()[0]);
value.setFlags(((BytePartialDecoder)decoder).getValue()[1]);
decoder = new IntPartialDecoder(4);
state = State.STREAMID;
break;
case STREAMID:
value.setStreamID(((IntPartialDecoder)decoder).getValue() & HTTP2_31BITS_MASK);
state = State.END;
break;
}
}
}
return state == State.END;
}