Class ConvertData

  • All Implemented Interfaces:
    ConverterResult

    public class ConvertData
    extends java.lang.Object
    implements ConverterResult

    ConvertData is used as a container for passing OutputFile objects in and out of the Convert class. The ConvertData contains a String name and a Vector of OutputFile objects.

    Author:
    Martin Maher
    • Constructor Summary

      Constructors 
      Constructor Description
      ConvertData()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addDocument​(OutputFile doc)
      Adds a OutputFile to the vector.
      OutputFile getMasterDocument()
      Get the master document
      java.lang.String getName()
      Returns the OutputFile name.
      int getNumDocuments()
      Gets the number of OutputFile objects currently stored
      boolean isMasterDocument​(OutputFile doc)
      Check if a given document is the master document
      java.util.Iterator iterator()
      Gets an Iterator to access the Vector of OutputFile objects
      void reset()
      Resets ConvertData.
      void setName​(java.lang.String docName)
      Sets the OutputFile name.
      void write​(java.io.File dir)
      Write all files of the ConverterResult to a directory.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConvertData

        public ConvertData()
    • Method Detail

      • reset

        public void reset()
        Resets ConvertData. This empties all OutputFile objects from this class. This allows reuse of a ConvertData.
      • getName

        public java.lang.String getName()
        Returns the OutputFile name.
        Returns:
        The OutputFile name.
      • setName

        public void setName​(java.lang.String docName)
        Sets the OutputFile name.
        Parameters:
        docName - The name of the OutputFile.
      • addDocument

        public void addDocument​(OutputFile doc)
        Adds a OutputFile to the vector.
        Parameters:
        doc - The OutputFile to add.
      • isMasterDocument

        public boolean isMasterDocument​(OutputFile doc)
        Check if a given document is the master document
        Parameters:
        doc - The OutputFile to check
        Returns:
        true if this is the master document
      • iterator

        public java.util.Iterator iterator()
        Gets an Iterator to access the Vector of OutputFile objects
        Specified by:
        iterator in interface ConverterResult
        Returns:
        The Iterator to access the Vector of OutputFile objects.
      • getNumDocuments

        public int getNumDocuments()
        Gets the number of OutputFile objects currently stored
        Returns:
        The number of OutputFile objects currently stored.
      • write

        public void write​(java.io.File dir)
                   throws java.io.IOException
        Description copied from interface: ConverterResult
        Write all files of the ConverterResult to a directory. Subdirectories are created as required by the individual OutputFiles.
        Specified by:
        write in interface ConverterResult
        Parameters:
        dir - the directory to write to (this directory must exist). If the parameter is null, the default directory is used
        Throws:
        java.io.IOException - if the directory does not exist or one or more files could not be written