Class StreamWriterBase

    • Field Detail

      • m_quotEntityBytes

        protected final byte[] m_quotEntityBytes
      • m_ampEntityBytes

        protected final byte[] m_ampEntityBytes
      • m_gtEntityBytes

        protected final byte[] m_gtEntityBytes
      • m_ltEntityBytes

        protected final byte[] m_ltEntityBytes
      • m_cdataStartBytes

        protected final byte[] m_cdataStartBytes
      • m_cdataEndBytes

        protected final byte[] m_cdataEndBytes
      • m_encodingName

        private final java.lang.String m_encodingName
        Name of encoding used for stream.
      • m_baseWriter

        private final StreamWriterBase m_baseWriter
        Original writer (only used when created using copy constructor, null otherwise).
      • m_buffer

        protected byte[] m_buffer
        Cached reference to byte array used by buffer.
      • m_fillOffset

        protected int m_fillOffset
        Current fill offset in buffer byte array.
      • m_prefixBytes

        protected byte[][] m_prefixBytes
        Byte sequences for prefixes of namespaces in scope.
      • m_extensionBytes

        protected byte[][][] m_extensionBytes
        Byte sequences for prefixes of extension namespaces in scope.
      • m_indent

        private boolean m_indent
        Indent tags for pretty-printed text.
      • m_indentBase

        private int m_indentBase
        Base number of characters in indent sequence (end of line only).
      • m_indentPerLevel

        private int m_indentPerLevel
        Number of extra characters in indent sequence per level of nesting.
      • m_indentSequence

        private byte[] m_indentSequence
        Raw text for indentation sequences.
    • Constructor Detail

      • StreamWriterBase

        protected StreamWriterBase​(java.lang.String enc,
                                   java.lang.String[] uris)
        Constructor with supplied buffer.
        Parameters:
        enc - character encoding used for output to streams (upper case)
        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")
      • StreamWriterBase

        public StreamWriterBase​(StreamWriterBase base,
                                java.lang.String[] uris)
        Copy constructor. This takes the stream and encoding information 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 StreamWriterBase(String, String[]))
    • Method Detail

      • setBuffer

        public void setBuffer​(IOutByteBuffer buff)
        Set the byte buffer.
        Parameters:
        buff -
      • getEncodingName

        public java.lang.String getEncodingName()
        Get the name of the character encoding used by this writer.
        Returns:
        encoding
      • setNamespaceUris

        public void setNamespaceUris​(java.lang.String[] uris)
                              throws java.io.IOException
        Set namespace URIs. This forces a reset of the writer, clearing any buffered output. It is intended to be used only for reconfiguring an existing writer for reuse.
        Parameters:
        uris - ordered array of URIs for namespaces used in document
        Throws:
        java.io.IOException
      • setIndentSpaces

        public void setIndentSpaces​(int count,
                                    java.lang.String newline,
                                    char indent)
        Set nesting indentation. This is advisory only, and implementations of this interface are free to ignore it. The intent is to indicate that the generated output should use indenting to illustrate element nesting.
        Parameters:
        count - number of character to indent per level, or disable indentation if negative (zero means new line only)
        newline - sequence of characters used for a line ending (null means use the single character '\n')
        indent - whitespace character used for indentation
      • makeSpace

        protected void makeSpace​(int length)
                          throws java.io.IOException
        Make at least the requested number of bytes available in the output buffer. If necessary, the output buffer will be replaced by a larger buffer.
        Parameters:
        length - number of bytes space to be made available
        Throws:
        java.io.IOException - if error writing to document
      • undefineNamespace

        protected void undefineNamespace​(int index)
        Report that namespace has been undefined.
        Specified by:
        undefineNamespace in class XMLWriterNamespaceBase
        Parameters:
        index - post-translation namespace URI index number
      • writePrefix

        protected void writePrefix​(int index)
                            throws java.io.IOException
        Write namespace prefix to output. This internal method is used to throw an exception when an undeclared prefix is used.
        Specified by:
        writePrefix in class XMLWriterBase
        Parameters:
        index - namespace URI index number
        Throws:
        java.io.IOException - if error writing to document
      • writeEntity

        protected int writeEntity​(byte[] bytes,
                                  int offset)
        Write entity bytes to output.
        Parameters:
        bytes - actual bytes to be written
        offset - starting offset in buffer
        Returns:
        offset for next data byte in buffer
      • indent

        public void indent​(int bias)
                    throws java.io.IOException
        Request output indent. Output the line end sequence followed by the appropriate number of indent characters.
        Specified by:
        indent in class XMLWriterBase
        Parameters:
        bias - indent depth difference (positive or negative) from current element nesting depth
        Throws:
        java.io.IOException - on error writing to document
      • indent

        public void indent()
                    throws java.io.IOException
        Request output indent. Output the line end sequence followed by the appropriate number of indent characters for the current nesting level.
        Throws:
        java.io.IOException - on error writing to document
      • flush

        public void flush()
                   throws java.io.IOException
        Flush document output. Forces out all output generated to this point.
        Specified by:
        flush in interface IXMLWriter
        Specified by:
        flush in class XMLWriterBase
        Throws:
        java.io.IOException - on error writing to document
      • close

        public void close()
                   throws java.io.IOException
        Close document output. Completes writing of document output, including closing the output medium.
        Specified by:
        close in interface IXMLWriter
        Specified by:
        close in class XMLWriterBase
        Throws:
        java.io.IOException - on error writing to document