當前位置: 首頁>>代碼示例>>Java>>正文


Java XMLLightweightParser類代碼示例

本文整理匯總了Java中org.jivesoftware.openfire.nio.XMLLightweightParser的典型用法代碼示例。如果您正苦於以下問題:Java XMLLightweightParser類的具體用法?Java XMLLightweightParser怎麽用?Java XMLLightweightParser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


XMLLightweightParser類屬於org.jivesoftware.openfire.nio包,在下文中一共展示了XMLLightweightParser類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doDecode

import org.jivesoftware.openfire.nio.XMLLightweightParser; //導入依賴的package包/類
@Override
  public boolean doDecode(IoSession session, IoBuffer in,
          ProtocolDecoderOutput out) throws Exception {
      // log.debug("doDecode(...)...");

      XMLLightweightParser parser = (XMLLightweightParser) session
              .getAttribute(XmppIoHandler.XML_PARSER);
      parser.read(in);

// 如果有消息
      if (parser.areThereMsgs()) {
          for (String stanza : parser.getMsgs()) {
              out.write(stanza);
          }
      }
      
// 是否還有剩餘
      return !in.hasRemaining();
  }
 
開發者ID:lijian17,項目名稱:androidpn-server,代碼行數:20,代碼來源:XmppDecoder.java

示例2: doDecode

import org.jivesoftware.openfire.nio.XMLLightweightParser; //導入依賴的package包/類
@Override
public boolean doDecode(IoSession session, IoBuffer in,
        ProtocolDecoderOutput out) throws Exception {
    // log.debug("doDecode(...)...");

    XMLLightweightParser parser = (XMLLightweightParser) session
            .getAttribute(XmppIoHandler.XML_PARSER);
    parser.read(in);

    if (parser.areThereMsgs()) {
        for (String stanza : parser.getMsgs()) {
            out.write(stanza);
        }
    }
    return !in.hasRemaining();
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:17,代碼來源:XmppDecoder.java

示例3: doDecode

import org.jivesoftware.openfire.nio.XMLLightweightParser; //導入依賴的package包/類
@Override
public boolean doDecode(IoSession session, IoBuffer in,
        ProtocolDecoderOutput out) throws Exception {
    log.debug("doDecode(...)...");

    // Get the XML light parser from the IoSession
    XMLLightweightParser parser = (XMLLightweightParser) session
            .getAttribute("XML-PARSER");
    // Parse as many stanzas as possible from the received data
    parser.read(in);

    if (parser.areThereMsgs()) {
        for (String stanza : parser.getMsgs()) {
            out.write(stanza);
        }
    }
    return !in.hasRemaining();
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:19,代碼來源:XmppDecoder.java

示例4: doDecode

import org.jivesoftware.openfire.nio.XMLLightweightParser; //導入依賴的package包/類
@Override
public boolean doDecode(IoSession session, IoBuffer in,
        ProtocolDecoderOutput out) throws Exception {
    log.debug("doDecode(...)...");

    XMLLightweightParser parser = (XMLLightweightParser) session
            .getAttribute("XML_PARSER");
    parser.read(in);

    if (parser.areThereMsgs()) {
        for (String stanza : parser.getMsgs()) {
            out.write(stanza);
        }
    }
    return !in.hasRemaining();
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:17,代碼來源:XmppDecoder.java

示例5: sessionOpened

import org.jivesoftware.openfire.nio.XMLLightweightParser; //導入依賴的package包/類
/**
 * 當一個連接被打開時,將被調用
 */
public void sessionOpened(IoSession session) throws Exception {
	log.debug("sessionOpened()...");
	log.debug("remoteAddress=" + session.getRemoteAddress());
	// 創建一個新的XML解析器
	XMLLightweightParser parser = new XMLLightweightParser("UTF-8");
	session.setAttribute(XML_PARSER, parser);
	// 創建一個新的連接
	Connection connection = new Connection(session);
	session.setAttribute(CONNECTION, connection);
	session.setAttribute(STANZA_HANDLER, new StanzaHandler(serverName,
			connection));
}
 
開發者ID:lijian17,項目名稱:androidpn-server,代碼行數:16,代碼來源:XmppIoHandler.java

示例6: sessionOpened

import org.jivesoftware.openfire.nio.XMLLightweightParser; //導入依賴的package包/類
/**
 * Invoked when a connection has been opened.
 */
public void sessionOpened(IoSession session) throws Exception {
    log.debug("sessionOpened()...");
    log.debug("remoteAddress=" + session.getRemoteAddress());
    // Create a new XML parser
    XMLLightweightParser parser = new XMLLightweightParser("UTF-8");
    session.setAttribute(XML_PARSER, parser);
    // Create a new connection
    Connection connection = new Connection(session);
    session.setAttribute(CONNECTION, connection);
    session.setAttribute(STANZA_HANDLER, new StanzaHandler(serverName,
            connection));
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:16,代碼來源:XmppIoHandler.java

示例7: sessionOpened

import org.jivesoftware.openfire.nio.XMLLightweightParser; //導入依賴的package包/類
public void sessionOpened(IoSession session) throws Exception {
    log.debug("sessionOpened()...");
    log.debug("remoteAddress=" + session.getRemoteAddress());
    // Create a new XML parser for the new connection
    XMLLightweightParser parser = new XMLLightweightParser(CHARSET);
    session.setAttribute(XML_PARSER, parser);
    // Create a new Connection for the new session
    Connection connection = new Connection(session);
    session.setAttribute(CONNECTION, connection);
    session.setAttribute(STANZA_HANDLER, new ClientStanzaHandler(
            serverName, connection));
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:13,代碼來源:XmppIoHandler.java

示例8: sessionOpened

import org.jivesoftware.openfire.nio.XMLLightweightParser; //導入依賴的package包/類
public void sessionOpened(IoSession session) throws Exception {
    log.debug("sessionOpened()...");
    log.debug("remoteAddress=" + session.getRemoteAddress());
    // Create a new XML parser
    XMLLightweightParser parser = new XMLLightweightParser(CHARSET);
    session.setAttribute(XML_PARSER, parser);
    // Create a new connection
    Connection connection = new Connection(session);
    session.setAttribute(CONNECTION, connection);
    session.setAttribute(STANZA_HANDLER, new StanzaHandler(
            serverName, connection));
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:13,代碼來源:XmppIoHandler.java

示例9: sessionOpened

import org.jivesoftware.openfire.nio.XMLLightweightParser; //導入依賴的package包/類
public void sessionOpened(IoSession session) throws Exception {
    log.debug("sessionOpened()...");
    log.debug("remoteAddress=" + session.getRemoteAddress());
    // Create a new XML parser
    XMLLightweightParser parser = new XMLLightweightParser(CHARSET);
    session.setAttribute(XML_PARSER, parser);
    // Create a new connection
    Connection connection = new Connection(session);
    session.setAttribute(CONNECTION, connection);
    session.setAttribute(STANZA_HANDLER, new ClientStanzaHandler(
            serverName, connection));
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:13,代碼來源:XmppIoHandler.java

示例10: sessionOpened

import org.jivesoftware.openfire.nio.XMLLightweightParser; //導入依賴的package包/類
public void sessionOpened(IoSession session) throws Exception {
	log.debug("sessionOpened()...");
	// Create a new XML parser for the new connection. The parser will be
	// used by the XMPPDecoder filter.
	XMLLightweightParser parser = new XMLLightweightParser(CHARSET);
	session.setAttribute(XML_PARSER, parser);
	// // Create a new Connection for the new session
	// Connection connection = new Connection(session);
	// session.setAttribute(CONNECTION, connection);
	// session.setAttribute(STANZA_HANDLER, new ClientStanzaHandler(
	// serverName, connection));
}
 
開發者ID:elphinkuo,項目名稱:Androidpn,代碼行數:13,代碼來源:XmppIoHandler.java


注:本文中的org.jivesoftware.openfire.nio.XMLLightweightParser類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。