|
||||||||||
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.BinarySink
public class BinarySink
A sink for generating default string representations from data objects.
This sink uses the presentation properties such as initiators, terminators, delimiters and pad characters defined in the source data model (.dod) file. Therefore if this sink is used to format an instance of a data model imported from a schema or the like the output will be a useless stream of undemarcated data values. A common usage of this class would be:
FileOutputStream out = new FileOutputStream("myfile.xml"); // note: stream clean up code has been ommited for clarity DefaultSink snk = new DefaultSink(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 | |
---|---|
BinarySink()
Constructs a new instance. |
|
BinarySink(BinarySink clone)
Constructs a new instance cloned from clone . |
|
BinarySink(OutputStream stream)
Constructs a new instance which will write to stream . |
|
BinarySink(Writer writer)
Constructs a new instance which will write to writer . |
Method Summary | |
---|---|
Object |
clone()
|
void |
setOutputStream(OutputStream stream)
Sets the output stream (optional operation). |
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, clearBatchIterators, getEncoding, getOutputStream, getWriter, registerBatchIterator, setEncoding, setWriter, stream, unregisterBatchIterator, writer |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BinarySink()
public BinarySink(BinarySink clone)
clone
.
clone
- The instance to clone.public BinarySink(OutputStream stream)
stream
.
stream
- The stream to write the data to.public BinarySink(Writer writer)
writer
.
writer
- The stream to write the data to.Method Detail |
---|
public void setOutputStream(OutputStream stream)
setOutputStream
in class Sink
stream
- The new value.
UnsupportedOperationException
- If this source does not support
output to a java.io.OutputStream, in which case a java.io.Writer should
be used.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 Object clone()
clone
in class Sink
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |