Package org.jibx.runtime.impl
Class UTF8StreamWriter
- java.lang.Object
-
- org.jibx.runtime.impl.XMLWriterNamespaceBase
-
- org.jibx.runtime.impl.XMLWriterBase
-
- org.jibx.runtime.impl.StreamWriterBase
-
- org.jibx.runtime.impl.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 Summary
Fields Modifier and Type Field Description private byte[]
m_converts
Conversion buffer for prefixes;-
Fields inherited from class org.jibx.runtime.impl.StreamWriterBase
m_ampEntityBytes, m_buffer, m_cdataEndBytes, m_cdataStartBytes, m_extensionBytes, m_fillOffset, m_gtEntityBytes, m_ltEntityBytes, m_prefixBytes, m_quotEntityBytes
-
Fields inherited from class org.jibx.runtime.impl.XMLWriterNamespaceBase
m_prefixes, m_uris
-
-
Constructor Summary
Constructors Constructor Description UTF8StreamWriter(java.lang.String[] uris)
Constructor with supplied buffer.UTF8StreamWriter(UTF8StreamWriter base, java.lang.String[] uris)
Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IXMLWriter
createChildWriter(java.lang.String[] uris)
Create a child writer instance to be used for a separate binding.protected void
defineNamespace(int index, java.lang.String prefix)
Report that namespace has been defined.protected void
writeAttributeText(java.lang.String text)
Write attribute text to output.void
writeCData(java.lang.String text)
Write CDATA text to document.protected void
writeMarkup(char chr)
Write markup character to output.protected void
writeMarkup(java.lang.String text)
Write markup text to output.void
writeTextContent(java.lang.String text)
Write ordinary character data text content to document.-
Methods inherited from class org.jibx.runtime.impl.StreamWriterBase
close, flush, getEncodingName, indent, indent, makeSpace, popExtensionNamespaces, pushExtensionNamespaces, setBuffer, setIndentSpaces, setNamespaceUris, undefineNamespace, writeEntity, writePrefix
-
Methods inherited from class org.jibx.runtime.impl.XMLWriterBase
addAttribute, closeEmptyTag, closeStartTag, endTag, flagContent, flagTextContent, init, reset, startTagClosed, startTagNamespaces, startTagOpen, writeComment, writeDocType, writeEntityRef, writePI, writeXMLDecl
-
Methods inherited from class org.jibx.runtime.impl.XMLWriterNamespaceBase
decrementNesting, getExtensionNamespaces, getNamespaceCount, getNamespacePrefix, getNamespaces, getNamespaceUri, getNestingDepth, getPrefixIndex, growArray, incrementNesting, internalNamespacePrefix, internalNamespaceUri, internalSetUris, openNamespaces, popTranslationTable, pushTranslationTable, shrinkArray, translateNamespace
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jibx.runtime.IXMLWriter
getExtensionNamespaces, getNamespaceCount, getNamespacePrefix, getNamespaces, getNamespaceUri, getNestingDepth, getPrefixIndex, openNamespaces, popTranslationTable, pushTranslationTable
-
-
-
-
Constructor Detail
-
UTF8StreamWriter
public UTF8StreamWriter(java.lang.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, java.lang.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 writeruris
- ordered array of URIs for namespaces used in document (seeUTF8StreamWriter(String[])
)
-
-
Method Detail
-
writeMarkup
protected void writeMarkup(java.lang.String text) throws java.io.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 classXMLWriterBase
- Parameters:
text
- markup text to be written- Throws:
java.io.IOException
- if error writing to document
-
writeMarkup
protected void writeMarkup(char chr) throws java.io.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 classXMLWriterBase
- Parameters:
chr
- markup character to be written- Throws:
java.io.IOException
- if error writing to document
-
defineNamespace
protected void defineNamespace(int index, java.lang.String prefix)
Report that namespace has been defined.- Specified by:
defineNamespace
in classXMLWriterNamespaceBase
- Parameters:
index
- post-translation namespace URI index numberprefix
- prefix used for namespace
-
writeAttributeText
protected void writeAttributeText(java.lang.String text) throws java.io.IOException
Write attribute text to output. This needs to write the text with any appropriate escaping.- Specified by:
writeAttributeText
in classXMLWriterBase
- Parameters:
text
- attribute value text to be written- Throws:
java.io.IOException
- if error writing to document
-
writeTextContent
public void writeTextContent(java.lang.String text) throws java.io.IOException
Write ordinary character data text content to document.- Parameters:
text
- content value text- Throws:
java.io.IOException
- on error writing to document
-
writeCData
public void writeCData(java.lang.String text) throws java.io.IOException
Write CDATA text to document.- Parameters:
text
- content value text- Throws:
java.io.IOException
- on error writing to document
-
createChildWriter
public IXMLWriter createChildWriter(java.lang.String[] uris) throws java.io.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 (seeUTF8StreamWriter(String[])
)- Returns:
- child writer
- Throws:
java.io.IOException
-
-