Package org.jxmpp.xml.splitter
Class Utf8ByteXmppXmlSplitter
java.lang.Object
java.io.OutputStream
org.jxmpp.xml.splitter.Utf8ByteXmppXmlSplitter
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Extended version of
XmppXmlSplitter allowing input to be bytes or
ByteBuffer representing a UTF-8 encoded XML string for XMPP. Just as
they come from a network socket.
This class respects the byte order mark (BOM )requirement of RFC 6120 11.6 and treats the BOM as zero width no-break space, and not as byte order mark.
-
Constructor Summary
ConstructorsConstructorDescriptionUtf8ByteXmppXmlSplitter(XmppElementCallback xmppElementCallback) Create a new splitter with the given callback.Utf8ByteXmppXmlSplitter(XmppXmlSplitter xmppXmlSplitter) Create a new UTF-8 splitter with the given XMPP XML splitter. -
Method Summary
Modifier and TypeMethodDescriptionvoidresetWriteBuffer(int size) Reset the write buffer to the given size.voidwrite(byte b) Write a single byte.voidwrite(byte[] b, int offset, int length) voidwrite(int b) voidwrite(ByteBuffer byteBuffer) Write the given byte buffer.voidwrite(ByteBuffer[] byteBuffers) Write the given array of byte buffers.voidwrite(Collection<? extends ByteBuffer> byteBuffers) Write the given collection of byte buffers.Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream, write
-
Constructor Details
-
Utf8ByteXmppXmlSplitter
Create a new splitter with the given callback.- Parameters:
xmppElementCallback- the callback invoked once a complete element has been processed.
-
Utf8ByteXmppXmlSplitter
Create a new UTF-8 splitter with the given XMPP XML splitter.- Parameters:
xmppXmlSplitter- the used XMPP XML splitter.
-
-
Method Details
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
Write a single byte. The byte must be part of a UTF-8 String.- Parameters:
b- the byte to write.- Throws:
IOException- if an error occurs.
-
write
Write the given array of byte buffers.- Parameters:
byteBuffers- the array of byte buffers.- Throws:
IOException- if an error occurs.
-
write
Write the given collection of byte buffers.- Parameters:
byteBuffers- the collection of byte buffers.- Throws:
IOException- if an error occurs.
-
write
Write the given byte buffer.- Parameters:
byteBuffer- the byte buffer.- Throws:
IOException- if an error occurs.
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
resetWriteBuffer
Reset the write buffer to the given size.- Parameters:
size- the new write buffer size.
-