Class AbstractXMLReader

All Implemented Interfaces:
IO, ProCAKEReader
Direct Known Subclasses:
AdaptationConfigReader, DependencyReader, ModelReader, NESTGraphReader, ObjectPoolReader, ObjectReader, SimilarityModelReader, TrainingObjectPoolReader, TransformationConfigReaderImpl

public abstract class AbstractXMLReader extends IOImpl implements ProCAKEReader
Base class for all XML-reader-implementations.
Author:
Alexander Stromer
  • Field Details

    • filename

      protected String filename
      The filename/filepath which should be used to read from.
    • inputStream

      protected InputStream inputStream
      The internal reader-object used for reading data.
  • Constructor Details

    • AbstractXMLReader

      public AbstractXMLReader()
  • Method Details

    • getFilename

      public String getFilename()
      Returns the name of the file, which was set to be read.
      Returns:
      The name of the file.
    • setFilename

      public void setFilename(String filename)
      Each reader must be able to read a file from a specified path.
      Specified by:
      setFilename in interface ProCAKEReader
      Parameters:
      filename - The filename that should be read.
    • setInputStream

      public void setInputStream(InputStream inputStream)
      Each reader must be able to read from an input stream.
      Specified by:
      setInputStream in interface ProCAKEReader
      Parameters:
      inputStream - The that should be read.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • provideHandler

      protected abstract AbstractXMLHandler provideHandler()
      Provides a handler by the subclass in order to be used to create the parser. This should reduce code duplicates.
      Returns:
      the provided content handler
    • read

      public Object read() throws CAKEIOException
      Reads the give filename or input source and returns the parsed object.
      Specified by:
      read in interface ProCAKEReader
      Returns:
      Returns the parsed object.
      Throws:
      CAKEIOException