|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jibx.runtime.impl.XMLWriterNamespaceBase
org.jibx.runtime.impl.XMLWriterBase
org.jibx.runtime.impl.StreamWriterBase
public abstract class StreamWriterBase
Base handler for marshalling text document to an output stream. This needs to be subclassed with implementation methods specific to the encoding used.
Field Summary | |
---|---|
protected byte[] |
m_ampEntityBytes
|
private StreamWriterBase |
m_baseWriter
Original writer (only used when created using copy constructor, null otherwise). |
protected byte[] |
m_buffer
Cached reference to byte array used by buffer. |
private IOutByteBuffer |
m_byteBuffer
Output buffer. |
protected byte[] |
m_cdataEndBytes
|
protected byte[] |
m_cdataStartBytes
|
private java.lang.String |
m_encodingName
Name of encoding used for stream. |
protected byte[][][] |
m_extensionBytes
Byte sequences for prefixes of extension namespaces in scope. |
protected int |
m_fillOffset
Current fill offset in buffer byte array. |
protected byte[] |
m_gtEntityBytes
|
private boolean |
m_indent
Indent tags for pretty-printed text. |
private int |
m_indentBase
Base number of characters in indent sequence (end of line only). |
private int |
m_indentPerLevel
Number of extra characters in indent sequence per level of nesting. |
private byte[] |
m_indentSequence
Raw text for indentation sequences. |
protected byte[] |
m_ltEntityBytes
|
protected byte[][] |
m_prefixBytes
Byte sequences for prefixes of namespaces in scope. |
protected byte[] |
m_quotEntityBytes
|
Fields inherited from class org.jibx.runtime.impl.XMLWriterNamespaceBase |
---|
m_prefixes, m_uris |
Constructor Summary | |
---|---|
|
StreamWriterBase(StreamWriterBase base,
java.lang.String[] uris)
Copy constructor. |
protected |
StreamWriterBase(java.lang.String enc,
java.lang.String[] uris)
Constructor with supplied buffer. |
Method Summary | |
---|---|
void |
close()
Close document output. |
void |
flush()
Flush document output. |
java.lang.String |
getEncodingName()
Get the name of the character encoding used by this writer. |
void |
indent()
Request output indent. |
void |
indent(int bias)
Request output indent. |
protected void |
makeSpace(int length)
Make at least the requested number of bytes available in the output buffer. |
void |
popExtensionNamespaces()
Remove extension namespace URIs. |
void |
pushExtensionNamespaces(java.lang.String[] uris)
Append extension namespace URIs to those in mapping. |
void |
setBuffer(IOutByteBuffer buff)
Set the byte buffer. |
void |
setIndentSpaces(int count,
java.lang.String newline,
char indent)
Set nesting indentation. |
void |
setNamespaceUris(java.lang.String[] uris)
Set namespace URIs. |
protected void |
undefineNamespace(int index)
Report that namespace has been undefined. |
protected int |
writeEntity(byte[] bytes,
int offset)
Write entity bytes to output. |
protected void |
writePrefix(int index)
Write namespace prefix to output. |
Methods inherited from class org.jibx.runtime.impl.XMLWriterBase |
---|
addAttribute, closeEmptyTag, closeStartTag, endTag, flagContent, flagTextContent, init, reset, startTagClosed, startTagNamespaces, startTagOpen, writeAttributeText, writeComment, writeDocType, writeEntityRef, writeMarkup, writeMarkup, writePI, writeXMLDecl |
Methods inherited from class org.jibx.runtime.impl.XMLWriterNamespaceBase |
---|
decrementNesting, defineNamespace, 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.IExtensibleWriter |
---|
createChildWriter |
Methods inherited from interface org.jibx.runtime.IXMLWriter |
---|
getExtensionNamespaces, getNamespaceCount, getNamespacePrefix, getNamespaces, getNamespaceUri, getNestingDepth, getPrefixIndex, openNamespaces, popTranslationTable, pushTranslationTable, writeCData, writeTextContent |
Field Detail |
---|
protected final byte[] m_quotEntityBytes
protected final byte[] m_ampEntityBytes
protected final byte[] m_gtEntityBytes
protected final byte[] m_ltEntityBytes
protected final byte[] m_cdataStartBytes
protected final byte[] m_cdataEndBytes
private IOutByteBuffer m_byteBuffer
private final java.lang.String m_encodingName
private final StreamWriterBase m_baseWriter
null
otherwise).
protected byte[] m_buffer
protected int m_fillOffset
protected byte[][] m_prefixBytes
protected byte[][][] m_extensionBytes
private boolean m_indent
private int m_indentBase
private int m_indentPerLevel
private byte[] m_indentSequence
Constructor Detail |
---|
protected StreamWriterBase(java.lang.String enc, java.lang.String[] uris)
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")public StreamWriterBase(StreamWriterBase base, java.lang.String[] uris)
base
- instance to be used as base for writeruris
- ordered array of URIs for namespaces used in document
(see StreamWriterBase(String, String[])
)Method Detail |
---|
public void setBuffer(IOutByteBuffer buff)
buff
- public java.lang.String getEncodingName()
public void setNamespaceUris(java.lang.String[] uris) throws java.io.IOException
uris
- ordered array of URIs for namespaces used in document
java.io.IOException
public void setIndentSpaces(int count, java.lang.String newline, char indent)
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 indentationprotected void makeSpace(int length) throws java.io.IOException
length
- number of bytes space to be made available
java.io.IOException
- if error writing to documentprotected void undefineNamespace(int index)
undefineNamespace
in class XMLWriterNamespaceBase
index
- post-translation namespace URI index numberprotected void writePrefix(int index) throws java.io.IOException
writePrefix
in class XMLWriterBase
index
- namespace URI index number
java.io.IOException
- if error writing to documentprotected int writeEntity(byte[] bytes, int offset)
bytes
- actual bytes to be writtenoffset
- starting offset in buffer
public void pushExtensionNamespaces(java.lang.String[] uris)
pushExtensionNamespaces
in interface IXMLWriter
pushExtensionNamespaces
in class XMLWriterNamespaceBase
uris
- namespace URIs to extend those in mappingpublic void popExtensionNamespaces()
pushExtensionNamespaces(java.lang.String[])
.
popExtensionNamespaces
in interface IXMLWriter
popExtensionNamespaces
in class XMLWriterNamespaceBase
public void indent(int bias) throws java.io.IOException
indent
in class XMLWriterBase
bias
- indent depth difference (positive or negative) from current
element nesting depth
java.io.IOException
- on error writing to documentpublic void indent() throws java.io.IOException
java.io.IOException
- on error writing to documentpublic void flush() throws java.io.IOException
flush
in interface IXMLWriter
flush
in class XMLWriterBase
java.io.IOException
- on error writing to documentpublic void close() throws java.io.IOException
close
in interface IXMLWriter
close
in class XMLWriterBase
java.io.IOException
- on error writing to document
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |