示例#1
0
 public static byte[] hexString2Bytes(String src) {
   try {
     return Hex.decodeHex(src.toCharArray());
   } catch (DecoderException e) {
     LOGGER.error("Decode byte[] error:{}", e);
     return ArrayUtils.EMPTY_BYTE_ARRAY;
   }
 }
示例#2
0
 public static String decode(String bytes) {
   try {
     return new String(Hex.decodeHex(bytes.toCharArray()), Charset.defaultCharset());
   } catch (DecoderException e) {
     LOGGER.error("Decode String error:{}", e);
     return StringUtils.EMPTY;
   }
 }
 @Override
 public void dispatchMessage(String messageBody) {
   if (messageBody != null) {
     logger.info("dispatch: " + messageBody);
     try {
       ActiveMQTextMessage message = new ActiveMQTextMessage();
       message.setText(messageBody);
       String destination = getDestination(messageBody);
       logger.info("destination:" + destination);
       if (destination != null) {
         pooledSessionProducer.sendQueue(destination, message);
       }
     } catch (MessageNotWriteableException e) {
       logger.error(e.getMessage());
       e
           .printStackTrace(); // To change body of catch statement use File | Settings | File
                               // Templates.
     }
   }
 }