public static List < Map . Entry < Integer , byte [ ] > > parseTemplatesShallow ( ByteBuf bb ) { final ImmutableList . Builder < Map . Entry < Integer , byte [ ] > > templates = ImmutableList . builder ( ) ; int len = bb . readUnsignedShort ( ) ; int p = 4 ; // flow set id and length field itself while ( p < len ) { final int start = bb . readerIndex ( ) ; final int templateId = bb . readUnsignedShort ( ) ; final int fieldCount = bb . readUnsignedShort ( ) ; final ImmutableList . Builder < NetFlowV9FieldDef > fieldDefs = ImmutableList . builder ( ) ; for ( int i = 0 ; i < fieldCount ; i ++ ) { int fieldType = bb . readUnsignedShort ( ) ; int fieldLength = bb . readUnsignedShort ( ) ; } final byte [ ] bytes = ByteBufUtil . getBytes ( bb , start , bb . readerIndex ( ) - start ) ; final Map . Entry < Integer , byte [ ] > template = Maps . immutableEntry ( templateId , bytes ) ; templates . add ( template ) ; p += 4 + fieldCount * 4 ; } return templates . build ( ) ; }
Like above but only retrieves the bytes and template ids