Class UTF8StreamWriter

All Implemented Interfaces:
IExtensibleWriter, IXMLWriter

public class UTF8StreamWriter extends StreamWriterBase
Handler for marshalling text document to a UTF-8 output stream.
Author:
Dennis M. Sosnoski
  • Field Details

    • m_converts

      private byte[] m_converts
      Conversion buffer for prefixes;
  • Constructor Details

    • UTF8StreamWriter

      public UTF8StreamWriter(String[] uris)
      Constructor with supplied buffer.
      Parameters:
      uris - ordered array of URIs for namespaces used in document (must be constant; the value in position 0 must always be the empty string "", and the value in position 1 must always be the XML namespace "http://www.w3.org/XML/1998/namespace")
    • UTF8StreamWriter

      public UTF8StreamWriter(UTF8StreamWriter base, String[] uris)
      Copy constructor. This takes the stream from a supplied instance, while setting a new array of namespace URIs. It's intended for use when invoking one binding from within another binding.
      Parameters:
      base - instance to be used as base for writer
      uris - ordered array of URIs for namespaces used in document (see UTF8StreamWriter(String[]))
  • Method Details

    • writeMarkup

      protected void writeMarkup(String text) throws IOException
      Write markup text to output. Markup text can be written directly to the output without the need for any escaping, but still needs to be properly encoded.
      Specified by:
      writeMarkup in class XMLWriterBase
      Parameters:
      text - markup text to be written
      Throws:
      IOException - if error writing to document
    • writeMarkup

      protected void writeMarkup(char chr) throws IOException
      Write markup character to output. Markup text can be written directly to the output without the need for any escaping, but still needs to be properly encoded.
      Specified by:
      writeMarkup in class XMLWriterBase
      Parameters:
      chr - markup character to be written
      Throws:
      IOException - if error writing to document
    • defineNamespace

      protected void defineNamespace(int index, String prefix)
      Report that namespace has been defined.
      Specified by:
      defineNamespace in class XMLWriterNamespaceBase
      Parameters:
      index - post-translation namespace URI index number
      prefix - prefix used for namespace
    • writeAttributeText

      protected void writeAttributeText(String text) throws IOException
      Write attribute text to output. This needs to write the text with any appropriate escaping.
      Specified by:
      writeAttributeText in class XMLWriterBase
      Parameters:
      text - attribute value text to be written
      Throws:
      IOException - if error writing to document
    • writeTextContent

      public void writeTextContent(String text) throws IOException
      Write ordinary character data text content to document.
      Parameters:
      text - content value text
      Throws:
      IOException - on error writing to document
    • writeCData

      public void writeCData(String text) throws IOException
      Write CDATA text to document.
      Parameters:
      text - content value text
      Throws:
      IOException - on error writing to document
    • createChildWriter

      public IXMLWriter createChildWriter(String[] uris) throws IOException
      Create a child writer instance to be used for a separate binding. The child writer inherits the stream and encoding from this writer, while using the supplied namespace URIs.
      Parameters:
      uris - ordered array of URIs for namespaces used in document (see UTF8StreamWriter(String[]))
      Returns:
      child writer
      Throws:
      IOException