Package org.apache.vysper.xml.sax.impl

Examples of org.apache.vysper.xml.sax.impl.DefaultNonBlockingXMLReader


     * @param boshHandler
     * @param req
     */
    public BoshDecoder(BoshHandler boshHandler, HttpServletRequest req) {
        request = req;
        reader = new DefaultNonBlockingXMLReader();
        ContentHandler contentHandler = new BoshSaxContentHandler(boshHandler, req);
        reader.setContentHandler(contentHandler);
    }
View Full Code Here


        input = IoBuffer.allocate(xml.length());
        input.setAutoExpand(true);
        input.put(xml.getBytes());
        input.flip();
        builderFactory = new StanzaBuilderFactory();
        reader = new DefaultNonBlockingXMLReader();
        reader.setContentHandler(this);
    }
View Full Code Here

            }
            input.put(buf, 0, n);
        }
        input.flip();
        builderFactory = new StanzaBuilderFactory();
        reader = new DefaultNonBlockingXMLReader();
        reader.setContentHandler(this);
    }
View Full Code Here

    public static void main(String[] args) throws Exception {

        IoBuffer opening = IoBuffer.wrap("<p:root xmlns:p='http://example.com'>".getBytes("UTF-8"));
        IoBuffer buffer = IoBuffer.wrap(SINGLE_LEVEL_XML.getBytes("UTF-8"));

        DefaultNonBlockingXMLReader reader = new DefaultNonBlockingXMLReader();
        CounterStanzaListener listener = new CounterStanzaListener();
        XMPPContentHandler contentHandler = new XMPPContentHandler();
        contentHandler.setListener(listener);
        reader.setContentHandler(contentHandler);

        StopWatch watch = new StopWatch();

        reader.parse(opening, CharsetUtil.UTF8_DECODER);
        for (int i = 0; i < 10000; i++) {
            buffer.position(0);
            reader.parse(buffer, CharsetUtil.UTF8_DECODER);
        }
        watch.stop();

        System.out.println(listener.counter + " stanzas parsed");
        System.out.println(watch);
View Full Code Here

    public static void main(String[] args) throws Exception {

        IoBuffer opening = IoBuffer.wrap("<p:root xmlns:p='http://example.com'>".getBytes("UTF-8"));
        IoBuffer buffer = IoBuffer.wrap(SINGLE_LEVEL_XML.getBytes("UTF-8"));

        DefaultNonBlockingXMLReader reader = new DefaultNonBlockingXMLReader();
        CounterStanzaListener listener = new CounterStanzaListener();
        XMPPContentHandler contentHandler = new XMPPContentHandler();
        contentHandler.setListener(listener);
        reader.setContentHandler(contentHandler);

        StopWatch watch = new StopWatch();

        reader.parse(opening, CharsetUtil.UTF8_DECODER);
        for (int i = 0; i < 10000; i++) {
            buffer.position(0);
            reader.parse(buffer, CharsetUtil.UTF8_DECODER);
        }
        watch.stop();

        System.out.println(listener.counter + " stanzas parsed");
        System.out.println(watch);
View Full Code Here

    @Override
    protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception {
        NonBlockingXMLReader reader = (NonBlockingXMLReader) session.getAttribute(SESSION_ATTRIBUTE_NAME);

        if (reader == null) {
            reader = new DefaultNonBlockingXMLReader();

            // we need to check the jabber:client/jabber:server NS declarations
            reader.setFeature(DefaultNonBlockingXMLReader.FEATURE_NAMESPACE_PREFIXES, true);

            // allow parser to restart XML stream
View Full Code Here

TOP

Related Classes of org.apache.vysper.xml.sax.impl.DefaultNonBlockingXMLReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.