|
||||||||||
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.SwiftSink
public class SwiftSink
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 TextualSink snk = new TextualSink(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 | |
---|---|
SwiftSink()
Constructs a new instance. |
|
SwiftSink(OutputStream stream)
Constructs a new instance which will write to stream . |
|
SwiftSink(SwiftSink clone)
Constructs a new instance cloned from clone . |
|
SwiftSink(Writer writer)
Constructs a new instance which will write to writer . |
Method Summary | |
---|---|
Object |
clone()
|
void |
writeObject(ComplexDataObject obj)
Writes an object to the writer or output stream that has been set. |
void |
writeObjectAux(ComplexDataObject obj)
|
protected Writer |
writer()
Used by subclasses to get a reference to the object responsible for writing the data. |
Methods inherited from class biz.c24.io.api.presentation.Sink |
---|
checkInit, clearBatchIterators, getEncoding, getOutputStream, getWriter, registerBatchIterator, setEncoding, setOutputStream, setWriter, stream, unregisterBatchIterator |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SwiftSink()
public SwiftSink(SwiftSink clone)
clone
.
clone
- The instance to clone.public SwiftSink(OutputStream stream)
stream
.
stream
- The stream to write the data to.public SwiftSink(Writer writer)
writer
.
writer
- The stream to write the data to.Method Detail |
---|
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 void writeObjectAux(ComplexDataObject obj) throws IOException
IOException
protected Writer writer() throws UnsupportedEncodingException
Sink
writer
in class Sink
UnsupportedEncodingException
- If the encoding is not supported.public Object clone()
clone
in class Sink
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |