@ Override public ByteBuffer getBytes ( ) { ByteBuffer bb = ByteBuffer . allocate ( HEADER_LENGTH + getTotalbody ( ) ) ; bb . put ( magic . getMagic ( ) ) ; bb . put ( opcode . getOpcode ( ) ) ; bb . putShort ( keylength ) ; bb . put ( extralength ) ; bb . put ( datatype ) ; bb . putShort ( vbucket ) ; bb . putInt ( totalbody ) ; bb . putInt ( opaque ) ; bb . putLong ( cas ) ; if ( hasFlags ) { int flag = 0 ; for ( int i = 0 ; i < flagList . size ( ) ; i ++ ) { flag |= flagList . get ( i ) . getFlags ( ) ; } bb . putInt ( flag ) ; } bb . put ( name . getBytes ( ) ) ; if ( hasBackfill ) { bb . putLong ( backfilldate ) ; } if ( hasVBucketList ) { bb . putShort ( ( short ) vblist . length ) ; for ( int i = 0 ; i < vblist . length ; i ++ ) { bb . putShort ( vblist [ i ] ) ; } } if ( hasVBucketCheckpoints ) { bb . putShort ( ( short ) vBucketCheckpoints . size ( ) ) ; for ( Short vBucket : vBucketCheckpoints . keySet ( ) ) { bb . putShort ( vBucket ) ; bb . putLong ( vBucketCheckpoints . get ( vBucket ) ) ; } } return ( ByteBuffer ) bb . flip ( ) ; }
Encodes the message into binary .