Class Writer


  • public abstract class Writer
    extends Object
    This class represents an abstract writer for writing objects into the file system.
    Author:
    Matthias Thimm, Anna Gessler
    • Constructor Detail

      • Writer

        public Writer​(Object obj)
        Creates a new writer for the given object.
        Parameters:
        obj - an object.
    • Method Detail

      • setObject

        public void setObject​(Object obj)
        Sets the object of this writer.
        Parameters:
        obj - some object
      • getObject

        public Object getObject()
        Returns the object of this writer.
        Returns:
        the object of this writer.
      • writeToString

        public abstract String writeToString()
        Writes the object into a string.
        Returns:
        the string representing the object.
      • writeToFile

        public void writeToFile​(String filename)
                         throws IOException
        Writes the object into the given file.
        Parameters:
        filename - the name of the file.
        Throws:
        IOException - if an IO issue occurs.