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 ofXmppXmlSplitterallowing input to be bytes orByteBufferrepresenting 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 voidresetWriteBuffer(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, 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:
writein 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:
writein classOutputStream- Throws:
IOException
-
resetWriteBuffer
public void resetWriteBuffer(int size)
Reset the write buffer to the given size.- Parameters:
size- the new write buffer size.
-
-