Interface Writer
-
- All Superinterfaces:
IO
- All Known Implementing Classes:
DependencyWriterImpl,ModelWriterImpl,NESTGraphWriterImpl,NESTSequentialWorkflowWriterImpl,NESTWorkflowWriterImpl,ObjectPoolWriterImpl,ObjectWriterImpl,Serializer,SimilarityModelWriterImpl,StringWriter,TrainingPoolWriter,WorkflowGraphMLYWriterImpl,WorkflowWriterImpl,XMLWriterImpl
public interface Writer extends IO
The Writer interface provides some common constants and methods for all io writers. The usage of a writer is quite simple:public void writeMyObject(Object value) { Writer writer = (Writer) IOFactory.newIO(value.getClass()); writer.setFilename("..."); // or use writer.setOutputStream(os) writer.store(value); }The Writer has to guarantee that
store(Object)is able to write the object for thatIO.isHandlerFor(Class)istrue.- Author:
- Rainer Maximini
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOMPONENTComponent: "cake.io" (LogComponentIdentifier.COMPONENT)static StringCOMPONENT_KEYComponent-Key: "02" (LogComponentIdentifier.COMPONENT_KEY_IOWRITER)static StringLOG_CANNOT_WRITECannot open file for writing.static StringLOG_NO_WRITER_FOUNDNo writer found for the specified class.static StringLOG_UNEXPECTED_IOEXCEPTIONUnexpected IOException.-
Fields inherited from interface de.uni_trier.wi2.procake.utils.io.IO
DEFAULT_ENCODING, LOG_CONTENTHANDLER_NOT_FOUND, LOG_FILE_NOT_FOUND, LOG_IO_EXCEPTION, LOG_READER_NOT_FOUND, LOG_SAX_EXCEPTION, LOG_UNKNOWN_PARAMETER, LOG_WRITER_NOT_FOUND, LOG_WRONG_PARAMATER_TYPE, RESOURCE_XML
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidsetFilename(String filename)Each writer must be able to write a file to the local filesytem.voidsetOutputStream(OutputStream output)Each writer must be able to store the object into an OutputStream.voidstore(Object value)The store command writes the given value.-
Methods inherited from interface de.uni_trier.wi2.procake.utils.io.IO
copy, getDescription, getFamily, getName, isHandlerFor, setFamily
-
-
-
-
Field Detail
-
COMPONENT
static final String COMPONENT
Component: "cake.io" (LogComponentIdentifier.COMPONENT)- See Also:
- Constant Field Values
-
COMPONENT_KEY
static final String COMPONENT_KEY
Component-Key: "02" (LogComponentIdentifier.COMPONENT_KEY_IOWRITER)- See Also:
- Constant Field Values
-
LOG_CANNOT_WRITE
static final String LOG_CANNOT_WRITE
Cannot open file for writing.- Component:
COMPONENT - Key: "0200"
- File
- See Also:
- Constant Field Values
- Component:
-
LOG_NO_WRITER_FOUND
static final String LOG_NO_WRITER_FOUND
No writer found for the specified class.- Component:
COMPONENT - Key: "0202"
- this
- Class
- See Also:
- Constant Field Values
- Component:
-
LOG_UNEXPECTED_IOEXCEPTION
static final String LOG_UNEXPECTED_IOEXCEPTION
Unexpected IOException.- Component:
COMPONENT - Key: "0201"
- this
- Exception
- See Also:
- Constant Field Values
- Component:
-
-
Method Detail
-
setFilename
void setFilename(String filename)
Each writer must be able to write a file to the local filesytem. The filename should be an absolute path.- Parameters:
filename- The filename into which the object should be stored.
-
setOutputStream
void setOutputStream(OutputStream output)
Each writer must be able to store the object into an OutputStream.- Parameters:
output- TheOutputStreaminto that the object should be stored.
-
store
void store(Object value) throws CakeIOException
The store command writes the given value.- Parameters:
value- The object that should be stored- Throws:
CakeIOException
-
-