|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbiz.c24.io.api.presentation.Sink
public abstract class Sink
A class used to write data objects to an output stream or writer in a specific format.
This class is subclassed by format specific specialisations.
The output stream or writer used by this class will never be closed - it is the responsibility of the calling class
to maintain a reference to the appropriate object so that it can be closed when no longer required.
If character data is required and no output stream has been set then the stream will be wrapped by a OutputStreamWriter
using the default charset. Therefore if an encoding other than the default is required, a java.io.OutputStreamWriter
should be instatiated with that encoding and then supplied to this class.
Constructor Summary | |
---|---|
Sink()
Constructs a new instance. |
|
Sink(OutputStream stream)
Constructs a new instance which will write to stream (optional operation). |
|
Sink(Writer writer)
Constructs a new instance which will write to writer (optional operation). |
Method Summary | |
---|---|
protected void |
checkInit()
Used by subclasses to ensure a writer or output stream has been set. |
void |
clearBatchIterators()
Clears all batch iterators registered with this Sink. |
abstract Object |
clone()
|
String |
getEncoding()
Get the character encoding for a byte stream. |
OutputStream |
getOutputStream()
Returns the output stream (optional operation). |
Writer |
getWriter()
Returns the writer (optional operation). |
void |
registerBatchIterator(Class batchedClass,
Iterator batchIterator)
Register a batch iterator against a particular class of batch entry. |
void |
setEncoding(String encoding)
Set the character encoding for a byte stream. |
void |
setOutputStream(OutputStream stream)
Sets the output stream (optional operation). |
void |
setWriter(Writer writer)
Sets the writer (optional operation). |
protected OutputStream |
stream()
Used by subclasses to get a reference to the output stream object responsible for writing the data. |
void |
unregisterBatchIterator(Class batchedClass)
Unregisters an iterator from a particular class of batch entry. |
abstract void |
writeObject(ComplexDataObject obj)
Writes an object to the writer or output stream that has been set. |
protected Writer |
writer()
Used by subclasses to get a reference to the object responsible for writing the data. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Sink()
public Sink(Writer writer)
writer
(optional operation).
writer
- The writer to write the data to.
UnsupportedOperationException
- If this source does not support output to a java.io.Writer, in which case a java.io.OutputStream should be used.public Sink(OutputStream stream)
stream
(optional operation).
stream
- The stream to write the data to.
UnsupportedOperationException
- If this source does not support output to a java.io.OutputStream, in which case a java.io.Writer should be used.Method Detail |
---|
public void setWriter(Writer writer)
writer
- The new value.
UnsupportedOperationException
- If this source does not support output to a java.io.Writer, in which case a java.io.OutputStream should be used.public Writer getWriter()
UnsupportedOperationException
- If this source does not support output to a java.io.Writer, in which case a java.io.OutputStream should be used.public void setOutputStream(OutputStream stream)
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 OutputStream getOutputStream()
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 setEncoding(String encoding)
encoding
- A string describing the character encoding. If null then UTF-8 will be used by default.public String getEncoding()
public abstract void writeObject(ComplexDataObject obj) throws IOException
obj
- The object to be written.
IOException
- If the complete object could not be written for any reason.
IllegalArgumentException
- If neither a writer nor an output stream has been set.protected OutputStream stream()
protected Writer writer() throws UnsupportedEncodingException
UnsupportedEncodingException
- If the encoding is not supported.protected void checkInit()
IllegalArgumentException
- If neither a writer nor an output stream has been set.public void registerBatchIterator(Class batchedClass, Iterator batchIterator)
writeObject(biz.c24.io.api.data.ComplexDataObject)
method.
batchedClass
- The class of the generated Element
, DataType
, or ComplexDataObject
to register the iterator against.batchIterator
- The iterator which will return the instances.
NullPointerException
- If either argument is null
IllegalArgumentException
- If either of the arguments are not of the correct type or are taken directly from the C24 Integration Objects API.
\public void unregisterBatchIterator(Class batchedClass)
batchedClass
- The class which should be cleared from the map.registerBatchIterator(Class, java.util.Iterator)
public void clearBatchIterators()
public abstract Object clone()
clone
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |