- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
- flowStatsBuilder.setTableId(input.readUnsignedByte());
- input.skipBytes(PADDING_IN_FLOW_STATS_HEADER_01);
- flowStatsBuilder.setDurationSec(input.readUnsignedInt());
- flowStatsBuilder.setDurationNsec(input.readUnsignedInt());
- flowStatsBuilder.setPriority(input.readUnsignedShort());
- flowStatsBuilder.setIdleTimeout(input.readUnsignedShort());
- flowStatsBuilder.setHardTimeout(input.readUnsignedShort());
- flowStatsBuilder.setFlags(createFlowModFlagsFromBitmap(input.readShort()));
- input.skipBytes(PADDING_IN_FLOW_STATS_HEADER_02);
+ int flowRecordLength = input.readUnsignedShort();
+ ByteBuf subInput = input.readSlice(flowRecordLength - EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ flowStatsBuilder.setTableId(subInput.readUnsignedByte());
+ subInput.skipBytes(PADDING_IN_FLOW_STATS_HEADER_01);
+ flowStatsBuilder.setDurationSec(subInput.readUnsignedInt());
+ flowStatsBuilder.setDurationNsec(subInput.readUnsignedInt());
+ flowStatsBuilder.setPriority(subInput.readUnsignedShort());
+ flowStatsBuilder.setIdleTimeout(subInput.readUnsignedShort());
+ flowStatsBuilder.setHardTimeout(subInput.readUnsignedShort());
+ flowStatsBuilder.setFlags(createFlowModFlagsFromBitmap(subInput.readUnsignedShort()));
+ subInput.skipBytes(PADDING_IN_FLOW_STATS_HEADER_02);