private Invoke decodeAction ( Encoding encoding , IoBuffer in , Header header ) { // for response, the action string and invokeId is always encoded as AMF0 we use the first byte to decide which encoding to use in . mark ( ) ; byte tmp = in . get ( ) ; in . reset ( ) ; Input input ; if ( encoding == Encoding . AMF3 && tmp == AMF . TYPE_AMF3_OBJECT ) { input = new org . red5 . io . amf3 . Input ( in ) ; ( ( org . red5 . io . amf3 . Input ) input ) . enforceAMF3 ( ) ; } else { input = new org . red5 . io . amf . Input ( in ) ; } // get the action String action = Deserializer . deserialize ( input , String . class ) ; if ( action == null ) { throw new RuntimeException ( "Action was null" ) ; } if ( log . isTraceEnabled ( ) ) { log . trace ( "Action: {}" , action ) ; } // instance the invoke Invoke invoke = new Invoke ( ) ; // set the transaction id invoke . setTransactionId ( readTransactionId ( input ) ) ; // reset and decode parameters input . reset ( ) ; // get / set the parameters if there any Object [ ] params = in . hasRemaining ( ) ? handleParameters ( in , invoke , input ) : new Object [ 0 ] ; // determine service information final int dotIndex = action . lastIndexOf ( ' ' ) ; String serviceName = ( dotIndex == - 1 ) ? null : action . substring ( 0 , dotIndex ) ; // pull off the prefixes since java doesn't allow this on a method name if ( serviceName != null && ( serviceName . startsWith ( "@" ) || serviceName . startsWith ( "|" ) ) ) { serviceName = serviceName . substring ( 1 ) ; } String serviceMethod = ( dotIndex == - 1 ) ? action : action . substring ( dotIndex + 1 , action . length ( ) ) ; // pull off the prefixes since java doesnt allow this on a method name if ( serviceMethod . startsWith ( "@" ) || serviceMethod . startsWith ( "|" ) ) { serviceMethod = serviceMethod . substring ( 1 ) ; } // create the pending call for invoke PendingCall call = new PendingCall ( serviceName , serviceMethod , params ) ; invoke . setCall ( call ) ; return invoke ; }
Decode the action for a supplied an Invoke .