question: @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public Object decode ( ByteBuffer buffer ) { byte type = buffer . get ( ) ; switch ( type ) { case TYPE_NULL : return null ; case TYPE_LIST : { int length = buffer . getInt ( ) ; List l = new ArrayList ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { l . add ( decode ( buffer ) ) ; } return l ; } case TYPE_SET : { int length = buffer . getInt ( ) ; Set l = new HashSet ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { l . add ( decode ( buffer ) ) ; } return l ; } case TYPE_MAP : { int length = buffer . getInt ( ) ; Map l = new HashMap ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { l . put ( decode ( buffer ) , decode ( buffer ) ) ; } return l ; } case TYPE_STRING : return stringEncoder . decode ( buffer ) ; case TYPE_BOOLEAN_TRUE : return Boolean . TRUE ; case TYPE_BOOLEAN_FALSE : return Boolean . FALSE ; case TYPE_UNSIGNED_LONG : return unsignedLongEncoder . decode ( buffer ) ; case TYPE_UNSIGNED_INT : return unsignedIntEncoder . decode ( buffer ) ; case TYPE_LONG : return Long . valueOf ( buffer . getLong ( ) ) ; case TYPE_INT : return Integer . valueOf ( buffer . getInt ( ) ) ; case TYPE_SHORT : return Short . valueOf ( buffer . getShort ( ) ) ; case TYPE_BYTE : return Byte . valueOf ( buffer . get ( ) ) ; case TYPE_DOUBLE : return Double . valueOf ( buffer . getDouble ( ) ) ; case TYPE_FLOAT : return Float . valueOf ( buffer . getFloat ( ) ) ; case TYPE_CHAR : return Character . valueOf ( buffer . getChar ( ) ) ; case TYPE_DATE : return new Date ( buffer . getLong ( ) ) ; default : throw new IllegalArgumentException ( "Invalid type " + type ) ; } }
target:  Decode the object from byte buffer. The input buffer should be readable.