public Object decode ( RTMPConnection conn , RTMPDecodeState state , IoBuffer in ) throws ProtocolException { //if (log.isTraceEnabled()) { //log.trace("Decoding for {}", conn.getSessionId()); //} try { final byte connectionState = conn . getStateCode ( ) ; switch ( connectionState ) { case RTMP . STATE_CONNECTED : return decodePacket ( conn , state , in ) ; case RTMP . STATE_ERROR : case RTMP . STATE_DISCONNECTING : case RTMP . STATE_DISCONNECTED : // throw away any remaining input data: in . clear ( ) ; return null ; default : throw new IllegalStateException ( "Invalid RTMP state: " + connectionState ) ; } } catch ( ProtocolException pe ) { // raise to caller unmodified throw pe ; } catch ( RuntimeException e ) { throw new ProtocolException ( "Error during decoding" , e ) ; } finally { //if (log.isTraceEnabled()) { //log.trace("Decoding finished for {}", conn.getSessionId()); //} } }
Decodes the buffer data .