|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbiz.c24.io.api.presentation.Sink
biz.c24.io.api.presentation.XMLSink
public class XMLSink
A sink for generating XML from data objects. A common usage of this class would be:
FileOutputStream out = new FileOutputStream("myfile.xml"); // note: stream clean up code has been ommited for clarity XMLSink snk = new XMLSink(out); snk.writeObject(myObj); // where my element is the root complex data object holding the data hierarchy to be formatted.Note that this implementation is not synchronized. If multiple threads use an instance concurrently, it must be synchronized externally.
Sink
,
Serialized FormConstructor Summary | |
---|---|
XMLSink()
Constructs a new instance. |
|
XMLSink(OutputStream stream)
Constructs a new instance which will write to stream . |
|
XMLSink(Writer writer)
Constructs a new instance which will write to wrtier . |
|
XMLSink(XMLSink clone)
Constructs a new instance cloned from clone . |
Method Summary | |
---|---|
void |
clearBatchIterators()
Clears all batch iterators registered with this Sink. |
Object |
clone()
|
org.apache.xml.serialize.OutputFormat |
getFormat()
Returns the output format. |
SAXSink |
getWrappedSink()
Returns the wrapped SAX sink on which this sink is based. |
boolean |
isHumanReadable()
Deprecated. Use getFormat() .getIndenting() instead. |
boolean |
isWriteOptionalDefaultValues()
Deprecated. Use getWrappedSink() .isWriteOptionalDefaultValues() instead. |
boolean |
isWriteOptionalFixedValues()
Deprecated. Use getWrappedSink() .isWriteOptionalFixedValues() instead. |
boolean |
isWriteXMLHeader()
Deprecated. Use ! getFormat() .getOmitXMLDeclaration() instead. |
void |
registerBatchIterator(Class batchEntry,
Iterator batchIterator)
Register a batch iterator against a particular class of batch entry. |
void |
setFormat(org.apache.xml.serialize.OutputFormat format)
Sets the output format. |
void |
setHumanReadable(boolean humanReadable)
Deprecated. Use getFormat() .setIndenting(boolean) instead. |
void |
setWriteOptionalDefaultValues(boolean writeOptionalDefaultValues)
Deprecated. Use getWrappedSink() .setWriteOptionalDefaultValues(boolean) instead. |
void |
setWriteOptionalFixedValues(boolean writeOptionalFixedValues)
Deprecated. Use getWrappedSink() .setWriteOptionalFixedValues(boolean) instead. |
void |
setWriteXMLHeader(boolean writeXMLHeader)
Deprecated. Use getFormat() .setOmitXMLDeclaration(!boolean) instead. |
void |
unregisterBatchIterator(Class batchEntry)
Unregisters an iterator from a particular class of batch entry. |
void |
writeObject(ComplexDataObject obj)
Writes an object to the writer or output stream that has been set. |
Methods inherited from class biz.c24.io.api.presentation.Sink |
---|
checkInit, getEncoding, getOutputStream, getWriter, setEncoding, setOutputStream, setWriter, stream, writer |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLSink()
public XMLSink(XMLSink clone)
clone
.
clone
- The instance to clone.public XMLSink(OutputStream stream)
stream
.
stream
- The stream to write the XML data to.public XMLSink(Writer writer)
wrtier
.
writer
- The writer to write the XML data to.Method Detail |
---|
public SAXSink getWrappedSink()
The wrapped sink provides access to additional configuration properties.
public org.apache.xml.serialize.OutputFormat getFormat()
The format object can be configured to control the style of the resulting XML.
public void setFormat(org.apache.xml.serialize.OutputFormat format)
format
- The new format.public void writeObject(ComplexDataObject obj) throws IOException
Sink
writeObject
in class Sink
obj
- The object to be written.
IOException
- If the complete object could not be written for any reason.public boolean isWriteOptionalDefaultValues()
getWrappedSink()
.isWriteOptionalDefaultValues()
instead.
public void setWriteOptionalDefaultValues(boolean writeOptionalDefaultValues)
getWrappedSink()
.setWriteOptionalDefaultValues(boolean)
instead.
writeOptionalDefaultValues
- The new value.public boolean isWriteOptionalFixedValues()
getWrappedSink()
.isWriteOptionalFixedValues()
instead.
public void setWriteOptionalFixedValues(boolean writeOptionalFixedValues)
getWrappedSink()
.setWriteOptionalFixedValues(boolean)
instead.
writeOptionalFixedValues
- The new value.public boolean isHumanReadable()
getFormat()
.getIndenting()
instead.
public void setHumanReadable(boolean humanReadable)
getFormat()
.setIndenting(boolean)
instead.
humanReadable
- The new value.public boolean isWriteXMLHeader()
getFormat()
.getOmitXMLDeclaration()
instead.
public void setWriteXMLHeader(boolean writeXMLHeader)
getFormat()
.setOmitXMLDeclaration(!boolean)
instead.
writeXMLHeader
- The new value.public void registerBatchIterator(Class batchEntry, Iterator batchIterator)
Sink
Sink.writeObject(biz.c24.io.api.data.ComplexDataObject)
method.
registerBatchIterator
in class Sink
batchEntry
- The class of the generated Element
, DataType
, or ComplexDataObject
to register the iterator against.batchIterator
- The iterator which will return the instances.public void unregisterBatchIterator(Class batchEntry)
Sink
unregisterBatchIterator
in class Sink
batchEntry
- The class which should be cleared from the map.Sink.registerBatchIterator(Class, java.util.Iterator)
public void clearBatchIterators()
Sink
clearBatchIterators
in class Sink
public Object clone()
clone
in class Sink
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |