private static int payloadOffset(final ByteBuf byteBuf) { int typeAndFlags = byteBuf.getShort(FRAME_TYPE_AND_FLAGS_FIELD_OFFSET); FrameType frameType = FrameType.fromEncodedType(typeAndFlags >> FRAME_TYPE_SHIFT); int result = PAYLOAD_OFFSET; switch (frameType) { case SETUP: result = SetupFrameFlyweight.payloadOffset(byteBuf); break; case ERROR: result = ErrorFrameFlyweight.payloadOffset(byteBuf); break; case LEASE: result = LeaseFrameFlyweight.payloadOffset(byteBuf); break; case KEEPALIVE: result = KeepaliveFrameFlyweight.payloadOffset(byteBuf); break; case REQUEST_RESPONSE: case REQUEST_FNF: case REQUEST_STREAM: case REQUEST_CHANNEL: result = RequestFrameFlyweight.payloadOffset(frameType, byteBuf); break; case REQUEST_N: result = RequestNFrameFlyweight.payloadOffset(byteBuf); break; } return result; }
private static int payloadOffset(final ByteBuf byteBuf) { int typeAndFlags = byteBuf.getShort(FRAME_TYPE_AND_FLAGS_FIELD_OFFSET); FrameType frameType = FrameType.fromEncodedType(typeAndFlags >> FRAME_TYPE_SHIFT); int result = PAYLOAD_OFFSET; switch (frameType) { case SETUP: result = SetupFrameFlyweight.payloadOffset(byteBuf); break; case ERROR: result = ErrorFrameFlyweight.payloadOffset(byteBuf); break; case LEASE: result = LeaseFrameFlyweight.payloadOffset(byteBuf); break; case KEEPALIVE: result = KeepaliveFrameFlyweight.payloadOffset(byteBuf); break; case REQUEST_RESPONSE: case REQUEST_FNF: case REQUEST_STREAM: case REQUEST_CHANNEL: result = RequestFrameFlyweight.payloadOffset(frameType, byteBuf); break; case REQUEST_N: result = RequestNFrameFlyweight.payloadOffset(byteBuf); break; } return result; }