|
||||||
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 is designed for use with character encodings that use standard one-byte values for Unicode characters in the 0x20-0x7F range, which includes the most widely used encodings for XML documents. It needs to be subclassed with implementation methods specific to the encoding used.
Field Summary | |
---|---|
protected static byte[] |
AMP_ENTITY
|
protected static byte[] |
GT_ENTITY
|
private static int |
INITIAL_BUFFER_SIZE
Default output buffer size. |
protected static byte[] |
LT_CDATAEND
|
protected static byte[] |
LT_CDATASTART
|
protected static byte[] |
LT_ENTITY
|
protected byte[] |
m_buffer
Buffer for accumulating output bytes. |
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 offset in filling buffer. |
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_prefixBytes
Byte sequences for prefixes of namespaces in scope. |
private java.io.OutputStream |
m_stream
Stream for text output. |
protected static byte[] |
QUOT_ENTITY
|
Fields inherited from class org.jibx.runtime.impl.XMLWriterBase |
---|
m_contentSeen, m_textSeen |
Fields inherited from class org.jibx.runtime.impl.XMLWriterNamespaceBase |
---|
m_prefixes, m_uris |
Constructor Summary | |
---|---|
StreamWriterBase(StreamWriterBase base,
java.lang.String[] uris)
Copy constructor. |
|
StreamWriterBase(java.lang.String enc,
java.lang.String[] uris)
Constructor. |
Method Summary | |
---|---|
void |
close()
Close document output. |
void |
flush()
Flush document output. |
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 |
reset()
Reset to initial state for reuse. |
void |
setIndentSpaces(int count,
java.lang.String newline,
char indent)
Set nesting indentation. |
void |
setOutput(java.io.OutputStream outs)
Set output stream. |
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, createChildWriter, endTag, 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, openNamespaces, shrinkArray |
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 |
---|
writeCData, writeTextContent |
Field Detail |
---|
protected static final byte[] QUOT_ENTITY
protected static final byte[] AMP_ENTITY
protected static final byte[] GT_ENTITY
protected static final byte[] LT_ENTITY
protected static final byte[] LT_CDATASTART
protected static final byte[] LT_CDATAEND
private static final int INITIAL_BUFFER_SIZE
private final java.lang.String m_encodingName
private java.io.OutputStream m_stream
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 |
---|
public StreamWriterBase(java.lang.String enc, java.lang.String[] uris)
enc
- character encoding used for output to streamsuris
- 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 setOutput(java.io.OutputStream outs)
outs
- stream for document data outputpublic 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
- 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 documentpublic void reset()
reset
in interface IXMLWriter
reset
in class XMLWriterBase
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |