public String encode(JainMgcpResponseEvent event) { DeleteConnectionResponse response = (DeleteConnectionResponse) event; ReturnCode returnCode = response.getReturnCode(); StringBuffer s = new StringBuffer(); s.append(returnCode.getValue()).append(SINGLE_CHAR_SPACE).append(response.getTransactionHandle()).append( SINGLE_CHAR_SPACE).append(returnCode.getComment()).append(NEW_LINE); if (response.getConnectionParms() != null) { s.append(response.getConnectionParms()).append(NEW_LINE); } return s.toString(); }
public int encode(JainMgcpResponseEvent event,byte[] array) { DeleteConnectionResponse response = (DeleteConnectionResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (response.getConnectionParms() != null) { array[totalLength++]=StringFunctions.HIGH_P_BYTE; array[totalLength++]=StringFunctions.COLON_BYTE; totalLength+=ConnectionParmHandler.encodeList(array,totalLength,response.getConnectionParms()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; } return totalLength; }
public int encode(JainMgcpResponseEvent event,byte[] array) { DeleteConnectionResponse response = (DeleteConnectionResponse) event; ReturnCode returnCode = response.getReturnCode(); int totalLength=ReturnCodeHandler.encode(array,0,returnCode); array[totalLength++]=StringFunctions.SPACE_BYTE; totalLength+=StringFunctions.encodeInt(array,totalLength,response.getTransactionHandle()); array[totalLength++]=StringFunctions.SPACE_BYTE; byte[] commentBytes=returnCode.getComment().getBytes(); System.arraycopy(commentBytes, 0, array,totalLength, commentBytes.length); totalLength+=commentBytes.length; array[totalLength++]=StringFunctions.NEWLINE_BYTE; if (response.getConnectionParms() != null) { array[totalLength++]=StringFunctions.HIGH_P_BYTE; array[totalLength++]=StringFunctions.COLON_BYTE; totalLength+=ConnectionParmHandler.encodeList(array,totalLength,response.getConnectionParms()); array[totalLength++]=StringFunctions.NEWLINE_BYTE; } return totalLength; }
int responseCode = dcResponse.getReturnCode().getValue(); MgcpResponseType type = MgcpResponseType.getResponseTypeFromCode(responseCode);