Class Utf8ByteXmppXmlSplitter

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class Utf8ByteXmppXmlSplitter
    extends java.io.OutputStream
    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.

    • 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​(java.nio.ByteBuffer byteBuffer)
      Write the given byte buffer.
      void write​(java.nio.ByteBuffer[] byteBuffers)
      Write the given array of byte buffers.
      void write​(java.util.Collection<? extends java.nio.ByteBuffer> byteBuffers)
      Write the given collection of byte buffers.
      • Methods inherited from class java.io.OutputStream

        close, flush, nullOutputStream, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 java.io.IOException
        Specified by:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(byte b)
                   throws java.io.IOException
        Write a single byte. The byte must be part of a UTF-8 String.
        Parameters:
        b - the byte to write.
        Throws:
        java.io.IOException - if an error occurs.
      • write

        public void write​(java.nio.ByteBuffer[] byteBuffers)
                   throws java.io.IOException
        Write the given array of byte buffers.
        Parameters:
        byteBuffers - the array of byte buffers.
        Throws:
        java.io.IOException - if an error occurs.
      • write

        public void write​(java.util.Collection<? extends java.nio.ByteBuffer> byteBuffers)
                   throws java.io.IOException
        Write the given collection of byte buffers.
        Parameters:
        byteBuffers - the collection of byte buffers.
        Throws:
        java.io.IOException - if an error occurs.
      • write

        public void write​(java.nio.ByteBuffer byteBuffer)
                   throws java.io.IOException
        Write the given byte buffer.
        Parameters:
        byteBuffer - the byte buffer.
        Throws:
        java.io.IOException - if an error occurs.
      • write

        public void write​(byte[] b,
                          int offset,
                          int length)
                   throws java.io.IOException
        Overrides:
        write in class java.io.OutputStream
        Throws:
        java.io.IOException
      • resetWriteBuffer

        public void resetWriteBuffer​(int size)
        Reset the write buffer to the given size.
        Parameters:
        size - the new write buffer size.