Class Utf8XmlWriter


  • public final class Utf8XmlWriter
    extends ByteXmlWriter
    This is the generic implementation of XmlWriter, used if the destination is byte-based OutputStream, and encoding is UTF-8.
    • Constructor Detail

      • Utf8XmlWriter

        public Utf8XmlWriter​(WriterConfig cfg,
                             java.io.OutputStream out)
    • Method Detail

      • getHighestEncodable

        public int getHighestEncodable()
        Description copied from class: XmlWriter
        Method called by error reporting code, to figure out if a given character is encodable (without using character entities) with the current encoding or not.
        Specified by:
        getHighestEncodable in class XmlWriter
        Returns:
        Character code of the highest character that can be natively encoded.
      • writeRaw

        public void writeRaw​(char[] cbuf,
                             int offset,
                             int len)
                      throws java.io.IOException,
                             javax.xml.stream.XMLStreamException
        Description copied from class: ByteXmlWriter
        This method is heavily encoding-dependant, so it needs to be deferred to sub-classes
        Specified by:
        writeRaw in class ByteXmlWriter
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException
      • doConstructName

        protected WName doConstructName​(java.lang.String localName)
                                 throws javax.xml.stream.XMLStreamException
        Specified by:
        doConstructName in class ByteXmlWriter
        Throws:
        javax.xml.stream.XMLStreamException
      • doConstructName

        protected WName doConstructName​(java.lang.String prefix,
                                        java.lang.String localName)
                                 throws javax.xml.stream.XMLStreamException
        Specified by:
        doConstructName in class ByteXmlWriter
        Throws:
        javax.xml.stream.XMLStreamException
      • outputSurrogates

        protected final void outputSurrogates​(int surr1,
                                              int surr2)
                                       throws java.io.IOException,
                                              javax.xml.stream.XMLStreamException
        Description copied from class: ByteXmlWriter
        Method called to output a composite character, result of combining 2 surrogate characters.
        Specified by:
        outputSurrogates in class ByteXmlWriter
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException
      • output2ByteChar

        protected final void output2ByteChar​(int ch)
                                      throws java.io.IOException,
                                             javax.xml.stream.XMLStreamException
        Specified by:
        output2ByteChar in class ByteXmlWriter
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException
      • outputMultiByteChar

        protected final int outputMultiByteChar​(int ch,
                                                char[] cbuf,
                                                int inputOffset,
                                                int inputLen)
                                         throws java.io.IOException,
                                                javax.xml.stream.XMLStreamException
        Method called to output a character that is beyond range of 1- and 2-byte UTF-8 encodings. This means it's either invalid character, or needs to be encoded using 3- or 4-byte encoding.
        Specified by:
        outputMultiByteChar in class ByteXmlWriter
        Parameters:
        inputOffset - Input pointer after character has been handled; either same as one passed in, or one more if a surrogate character was succesfully handled
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException
      • outputStrictMultiByteChar

        protected final int outputStrictMultiByteChar​(int ch,
                                                      char[] cbuf,
                                                      int inputOffset,
                                                      int inputLen)
                                               throws java.io.IOException,
                                                      javax.xml.stream.XMLStreamException
        Description copied from class: ByteXmlWriter
        Method called to output a character beyond basic 1- or 2-byte encoding (code 0x0800 and above), without being able to use character entities
        Specified by:
        outputStrictMultiByteChar in class ByteXmlWriter
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException