Package rocks.xmpp.core.session.debug
Interface XmppDebugger
-
- All Superinterfaces:
ReaderInterceptor
,WriterInterceptor
- All Known Implementing Classes:
ConsoleDebugger
public interface XmppDebugger extends ReaderInterceptor, WriterInterceptor
A debugger interface, which allows to implement custom debugger implementation to log XMPP traffic.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description InputStream
createInputStream(InputStream inputStream)
Creates a new input stream from the actual input stream.OutputStream
createOutputStream(OutputStream outputStream)
Creates a new output stream from the actual output stream.void
initialize(XmppSession xmppSession)
This method is called when a new XMPP session is initialized.default void
process(Reader reader, Consumer<StreamElement> streamElement, ReaderInterceptorChain chain)
Processesdefault void
process(StreamElement streamElement, Writer writer, WriterInterceptorChain chain)
The stream element which will be written.void
readStanza(String xml, Object streamElement)
This method is called, whenever a stream element is read.void
writeStanza(String xml, Object streamElement)
This method is called, whenever a stream element is written.
-
-
-
Method Detail
-
initialize
void initialize(XmppSession xmppSession)
This method is called when a new XMPP session is initialized.- Parameters:
xmppSession
- The XMPP session.
-
writeStanza
void writeStanza(String xml, Object streamElement)
This method is called, whenever a stream element is written.- Parameters:
xml
- The xml representation of the stream element.streamElement
- The stream element. Maybe null, if no stream element, but an opening or closing stream element is written.
-
readStanza
void readStanza(String xml, Object streamElement)
This method is called, whenever a stream element is read.- Parameters:
xml
- The xml representation of the stream element.streamElement
- The stream element. Maybe null, if no stream element, but an opening or closing stream element is read.
-
createOutputStream
OutputStream createOutputStream(OutputStream outputStream)
Creates a new output stream from the actual output stream. This is useful is you want to log the actually written bytes. In this case you could fork the output stream and return the new forked stream.- Parameters:
outputStream
- The actual output stream.- Returns:
- The (forked) output stream.
-
createInputStream
InputStream createInputStream(InputStream inputStream)
Creates a new input stream from the actual input stream. This is useful is you want to log the actually read bytes. In this case you could fork the input stream and return the new forked stream.- Parameters:
inputStream
- The actual input stream.- Returns:
- The (forked) input stream.
-
process
default void process(StreamElement streamElement, Writer writer, WriterInterceptorChain chain) throws Exception
Description copied from interface:WriterInterceptor
The stream element which will be written.- Specified by:
process
in interfaceWriterInterceptor
- Parameters:
streamElement
- The stream element which will be written.writer
- The writer to which the stream element is written.chain
- The writer chain, which allows to proceed to the next interceptor.- Throws:
Exception
- Any exception happening during interception.
-
process
default void process(Reader reader, Consumer<StreamElement> streamElement, ReaderInterceptorChain chain) throws Exception
Description copied from interface:ReaderInterceptor
Processes- Specified by:
process
in interfaceReaderInterceptor
- Parameters:
reader
- The reader from which the stream is read.streamElement
- Listens for stream elements being read from the reader.chain
- The reader chain, which allows to proceed to the next interceptor.- Throws:
Exception
- Any exception happening during interception.
-
-