public static Dependencies fromThrift ( ByteBuffer bytes ) { long startTs = 0L ; long endTs = 0L ; List < DependencyLink > links = Collections . emptyList ( ) ; while ( true ) { ThriftField thriftField = ThriftField . read ( bytes ) ; if ( thriftField . type == TYPE_STOP ) break ; if ( thriftField . isEqualTo ( START_TS ) ) { startTs = bytes . getLong ( ) ; } else if ( thriftField . isEqualTo ( END_TS ) ) { endTs = bytes . getLong ( ) ; } else if ( thriftField . isEqualTo ( LINKS ) ) { int length = ThriftCodec . readListLength ( bytes ) ; if ( length == 0 ) continue ; links = new ArrayList <> ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { links . add ( DependencyLinkAdapter . read ( bytes ) ) ; } } else { skip ( bytes , thriftField . type ) ; } } return Dependencies . create ( startTs , endTs , links ) ; }
Reads from bytes serialized in TBinaryProtocol