Package rocks.xmpp.util
Class XmppStreamDecoder
- java.lang.Object
-
- rocks.xmpp.util.XmppStreamDecoder
-
- All Implemented Interfaces:
ReaderInterceptor
public final class XmppStreamDecoder extends Object implements ReaderInterceptor
Decodes an XMPP stream from a synchronous source (reader).Stream restarts can be achieved by using the
restart()methods.
-
-
Constructor Summary
Constructors Constructor Description XmppStreamDecoder(XMLInputFactory inputFactory, Supplier<javax.xml.bind.Unmarshaller> unmarshaller, String contentNamespace)Creates the XMPP encoder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidprocess(Reader reader, Consumer<StreamElement> streamElement, ReaderInterceptorChain chain)Processesvoidrestart()
-
-
-
Constructor Detail
-
XmppStreamDecoder
public XmppStreamDecoder(XMLInputFactory inputFactory, Supplier<javax.xml.bind.Unmarshaller> unmarshaller, String contentNamespace)
Creates the XMPP encoder.Because
Marshalleris not thread-safe, it is recommended to pass aThreadLocal<Marshaller>to this constructor, which ensures thread-safety during marshalling.- Parameters:
inputFactory- The XML input factory.unmarshaller- Supplies the marshaller which will convert objects to XML.contentNamespace- The stream namespace.
-
-
Method Detail
-
restart
public void restart()
-
process
public void process(Reader reader, Consumer<StreamElement> streamElement, ReaderInterceptorChain chain) throws Exception
Description copied from interface:ReaderInterceptorProcesses- Specified by:
processin 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.
-
-