biz.c24.io.api.presentation
Class SwiftSink

java.lang.Object
  extended by biz.c24.io.api.presentation.Sink
      extended by biz.c24.io.api.presentation.SwiftSink
All Implemented Interfaces:
Serializable, Cloneable

public class SwiftSink
extends Sink

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.

See Also:
Sink, Serialized Form

Constructor 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

SwiftSink

public SwiftSink()
Constructs a new instance.


SwiftSink

public SwiftSink(SwiftSink clone)
Constructs a new instance cloned from clone.

Parameters:
clone - The instance to clone.

SwiftSink

public SwiftSink(OutputStream stream)
Constructs a new instance which will write to stream.

Parameters:
stream - The stream to write the data to.

SwiftSink

public SwiftSink(Writer writer)
Constructs a new instance which will write to writer.

Parameters:
writer - The stream to write the data to.
Method Detail

writeObject

public void writeObject(ComplexDataObject obj)
                 throws IOException
Description copied from class: Sink
Writes an object to the writer or output stream that has been set.

Specified by:
writeObject in class Sink
Parameters:
obj - The object to be written.
Throws:
IOException - If the complete object could not be written for any reason.

writeObjectAux

public void writeObjectAux(ComplexDataObject obj)
                    throws IOException
Throws:
IOException

writer

protected Writer writer()
                 throws UnsupportedEncodingException
Description copied from class: Sink
Used by subclasses to get a reference to the object responsible for writing the data.

Overrides:
writer in class Sink
Returns:
The writer.
Throws:
UnsupportedEncodingException - If the encoding is not supported.

clone

public Object clone()
Specified by:
clone in class Sink


C24 Technologies © 2002-2012: All Rights Reserved.