Class SingleByteXmlWriter

  • Direct Known Subclasses:
    AsciiXmlWriter, Latin1XmlWriter

    public abstract class SingleByteXmlWriter
    extends ByteXmlWriter
    This is the common base class for writers that output to byte-backed output sources, and use Ascii or ISO-8859-1 (Latin1) encoding.
    • Constructor Detail

      • SingleByteXmlWriter

        public SingleByteXmlWriter​(WriterConfig cfg,
                                   java.io.OutputStream out,
                                   XmlCharTypes charTypes)
    • Method Detail

      • getHighestEncodable

        public abstract 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 abstract 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
      • 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
      • outputStrictMultiByteChar

        protected final int outputStrictMultiByteChar​(int ch,
                                                      char[] cbuf,
                                                      int inputOffset,
                                                      int inputLen)
                                               throws java.io.IOException,
                                                      javax.xml.stream.XMLStreamException
        With single byte encodings, there's no way to express these characters without character entities. So, this always leads to an exception
        Specified by:
        outputStrictMultiByteChar 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
        This can be done, although only by using character entities.
        Specified by:
        outputMultiByteChar in class ByteXmlWriter
        Throws:
        java.io.IOException
        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