Search in sources :

Example 1 with ObservableReader

use of org.jivesoftware.smack.util.ObservableReader in project Smack by igniterealtime.

the class SLF4JSmackDebugger method newConnectionReader.

@Override
public Reader newConnectionReader(Reader newReader) {
    reader.removeReaderListener(slf4JRawXmlListener);
    reader = new ObservableReader(newReader);
    reader.addReaderListener(slf4JRawXmlListener);
    return reader;
}
Also used : ObservableReader(org.jivesoftware.smack.util.ObservableReader)

Example 2 with ObservableReader

use of org.jivesoftware.smack.util.ObservableReader in project Smack by igniterealtime.

the class LiteDebugger method newConnectionReader.

@Override
public Reader newConnectionReader(Reader newReader) {
    ((ObservableReader) reader).removeReaderListener(readerListener);
    ObservableReader debugReader = new ObservableReader(newReader);
    debugReader.addReaderListener(readerListener);
    reader = debugReader;
    return reader;
}
Also used : ObservableReader(org.jivesoftware.smack.util.ObservableReader)

Example 3 with ObservableReader

use of org.jivesoftware.smack.util.ObservableReader in project Smack by igniterealtime.

the class AbstractDebugger method newConnectionReader.

@Override
public Reader newConnectionReader(Reader newReader) {
    reader.removeReaderListener(readerListener);
    ObservableReader debugReader = new ObservableReader(newReader);
    debugReader.addReaderListener(readerListener);
    reader = debugReader;
    return reader;
}
Also used : ObservableReader(org.jivesoftware.smack.util.ObservableReader)

Example 4 with ObservableReader

use of org.jivesoftware.smack.util.ObservableReader in project Smack by igniterealtime.

the class SmackDebugger method newConnectionReader.

/**
 * Returns a new special Reader that wraps the new connection Reader. The connection
 * has been secured so the connection is using a new reader and writer. The debugger
 * needs to wrap the new reader and writer to keep being notified of the connection
 * traffic.
 *
 * @param reader connection reader.
 * @return a new special Reader that wraps the new connection Reader.
 */
public final Reader newConnectionReader(Reader reader) {
    XmlPrettyPrinter xmlPrettyPrinter = XmlPrettyPrinter.builder().setPrettyWriter(sb -> incomingStreamSink(sb)).build();
    incomingStreamSplitterForPrettyPrinting = new XmppXmlSplitter(xmlPrettyPrinter);
    ObservableReader observableReader = new ObservableReader(reader);
    observableReader.addReaderListener(readString -> {
        try {
            incomingStreamSplitterForPrettyPrinting.append(readString);
        } catch (IOException e) {
            throw new AssertionError(e);
        }
    });
    return observableReader;
}
Also used : TopLevelStreamElement(org.jivesoftware.smack.packet.TopLevelStreamElement) ObservableWriter(org.jivesoftware.smack.util.ObservableWriter) Writer(java.io.Writer) XmppXmlSplitter(org.jxmpp.xml.splitter.XmppXmlSplitter) IOException(java.io.IOException) ObservableReader(org.jivesoftware.smack.util.ObservableReader) Reader(java.io.Reader) EntityFullJid(org.jxmpp.jid.EntityFullJid) XMPPConnection(org.jivesoftware.smack.XMPPConnection) XmlPrettyPrinter(org.jxmpp.xml.splitter.XmlPrettyPrinter) XmppXmlSplitter(org.jxmpp.xml.splitter.XmppXmlSplitter) ObservableReader(org.jivesoftware.smack.util.ObservableReader) XmlPrettyPrinter(org.jxmpp.xml.splitter.XmlPrettyPrinter) IOException(java.io.IOException)

Example 5 with ObservableReader

use of org.jivesoftware.smack.util.ObservableReader in project Smack by igniterealtime.

the class EnhancedDebugger method newConnectionReader.

@Override
public Reader newConnectionReader(Reader newReader) {
    ((ObservableReader) reader).removeReaderListener(readerListener);
    ObservableReader debugReader = new ObservableReader(newReader);
    debugReader.addReaderListener(readerListener);
    reader = debugReader;
    return reader;
}
Also used : ObservableReader(org.jivesoftware.smack.util.ObservableReader)

Aggregations

ObservableReader (org.jivesoftware.smack.util.ObservableReader)7 ObservableWriter (org.jivesoftware.smack.util.ObservableWriter)3 Color (java.awt.Color)2 Clipboard (java.awt.datatransfer.Clipboard)2 StringSelection (java.awt.datatransfer.StringSelection)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 JMenuItem (javax.swing.JMenuItem)2 JPanel (javax.swing.JPanel)2 JPopupMenu (javax.swing.JPopupMenu)2 JScrollPane (javax.swing.JScrollPane)2 JTextArea (javax.swing.JTextArea)2 ReaderListener (org.jivesoftware.smack.util.ReaderListener)2 WriterListener (org.jivesoftware.smack.util.WriterListener)2 BorderLayout (java.awt.BorderLayout)1 GridLayout (java.awt.GridLayout)1 MouseListener (java.awt.event.MouseListener)1 WindowAdapter (java.awt.event.WindowAdapter)1 WindowEvent (java.awt.event.WindowEvent)1 IOException (java.io.IOException)1