Package org.jxmpp.xml.splitter
Class Utf8ByteXmppXmlSplitter
- java.lang.Object
-
- java.io.OutputStream
-
- org.jxmpp.xml.splitter.Utf8ByteXmppXmlSplitter
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class Utf8ByteXmppXmlSplitter extends OutputStream
Extended version ofXmppXmlSplitter
allowing input to be bytes orByteBuffer
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
Constructors Constructor Description Utf8ByteXmppXmlSplitter(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
resetWriteBuffer(int size)
Reset the write buffer to the given size.void
write(byte b)
Write a single byte.void
write(byte[] b, int offset, int length)
void
write(int b)
void
write(ByteBuffer byteBuffer)
Write the given byte buffer.void
write(ByteBuffer[] byteBuffers)
Write the given array of byte buffers.void
write(Collection<? extends ByteBuffer> byteBuffers)
Write the given collection of byte buffers.-
Methods inherited from class java.io.OutputStream
close, flush, write
-
-
-
-
Constructor Detail
-
Utf8ByteXmppXmlSplitter
public Utf8ByteXmppXmlSplitter(XmppElementCallback xmppElementCallback)
Create a new splitter with the given callback.- Parameters:
xmppElementCallback
- the callback invoked once a complete element has been processed.
-
Utf8ByteXmppXmlSplitter
public Utf8ByteXmppXmlSplitter(XmppXmlSplitter xmppXmlSplitter)
Create a new UTF-8 splitter with the given XMPP XML splitter.- Parameters:
xmppXmlSplitter
- the used XMPP XML splitter.
-
-
Method Detail
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte b) throws IOException
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
public void write(ByteBuffer[] byteBuffers) throws IOException
Write the given array of byte buffers.- Parameters:
byteBuffers
- the array of byte buffers.- Throws:
IOException
- if an error occurs.
-
write
public void write(Collection<? extends ByteBuffer> byteBuffers) throws IOException
Write the given collection of byte buffers.- Parameters:
byteBuffers
- the collection of byte buffers.- Throws:
IOException
- if an error occurs.
-
write
public void write(ByteBuffer byteBuffer) throws IOException
Write the given byte buffer.- Parameters:
byteBuffer
- the byte buffer.- Throws:
IOException
- if an error occurs.
-
write
public void write(byte[] b, int offset, int length) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
resetWriteBuffer
public void resetWriteBuffer(int size)
Reset the write buffer to the given size.- Parameters:
size
- the new write buffer size.
-
-