⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 messagerenderer.java

📁 实现在电脑平台上控制短信modem或手机进行通讯的jar包和相关实例
💻 JAVA
字号:
/* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software * License version 1.1, a copy of which has been included with this * distribution in the LICENSE.txt file.  */package org.apache.log4j.or.jms;import org.apache.log4j.helpers.LogLog;import org.apache.log4j.or.ObjectRenderer;import javax.jms.Message;import javax.jms.JMSException;import javax.jms.DeliveryMode;/**   Render <code>javax.jms.Message</code> objects.   @author Ceki G&uuml;lc&uuml;   @since 1.0 */public class MessageRenderer implements ObjectRenderer {  public  MessageRenderer() {  }  /**     Render a {@link javax.jms.Message}.  */  public  String  doRender(Object o) {    if(o instanceof Message) {      StringBuffer sbuf = new StringBuffer();      Message m = (Message) o;      try {	sbuf.append("DeliveryMode=");	switch(m.getJMSDeliveryMode()) {	case DeliveryMode.NON_PERSISTENT :	  sbuf.append("NON_PERSISTENT");	  break;	case DeliveryMode.PERSISTENT :	  sbuf.append("PERSISTENT");	  break;	default: sbuf.append("UNKNOWN");	}	sbuf.append(", CorrelationID=");	sbuf.append(m.getJMSCorrelationID());	sbuf.append(", Destination=");	sbuf.append(m.getJMSDestination());	sbuf.append(", Expiration=");	sbuf.append(m.getJMSExpiration());	sbuf.append(", MessageID=");	sbuf.append(m.getJMSMessageID());	sbuf.append(", Priority=");	sbuf.append(m.getJMSPriority());	sbuf.append(", Redelivered=");	sbuf.append(m.getJMSRedelivered());	sbuf.append(", ReplyTo=");	sbuf.append(m.getJMSReplyTo());	sbuf.append(", Timestamp=");	sbuf.append(m.getJMSTimestamp());	sbuf.append(", Type=");	sbuf.append(m.getJMSType());	//Enumeration enum = m.getPropertyNames();	//while(enum.hasMoreElements()) {	//  String key = (String) enum.nextElement();	//  sbuf.append("; "+key+"=");	//  sbuf.append(m.getStringProperty(key));	//}      } catch(JMSException e) {	LogLog.error("Could not parse Message.", e);      }      return sbuf.toString();    } else {      return o.toString();    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -