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 that IO.isHandlerFor(Class) is true.

Author:
Rainer Maximini
  • Field Details

  • Method Details

    • 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 - The OutputStream into 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