Class FileHandler

    • Constructor Detail

      • FileHandler

        public FileHandler()
        Construct a new instance with no formatter and no output file.
      • FileHandler

        public FileHandler​(Formatter formatter)
        Construct a new instance with the given formatter and no output file.
        Parameters:
        formatter - the formatter
      • FileHandler

        public FileHandler​(Formatter formatter,
                           File file)
                    throws FileNotFoundException
        Construct a new instance with the given formatter and output file.
        Parameters:
        formatter - the formatter
        file - the file
        Throws:
        FileNotFoundException - if the file could not be found on open
      • FileHandler

        public FileHandler​(Formatter formatter,
                           File file,
                           boolean append)
                    throws FileNotFoundException
        Construct a new instance with the given formatter, output file, and append setting.
        Parameters:
        formatter - the formatter
        file - the file
        append - true to append, false to overwrite
        Throws:
        FileNotFoundException - if the file could not be found on open
      • FileHandler

        public FileHandler​(File file,
                           boolean append)
                    throws FileNotFoundException
        Construct a new instance with the given output file and append setting.
        Parameters:
        file - the file
        append - true to append, false to overwrite
        Throws:
        FileNotFoundException - if the file could not be found on open
      • FileHandler

        public FileHandler​(String fileName)
                    throws FileNotFoundException
        Construct a new instance with the given output file.
        Parameters:
        fileName - the file name
        Throws:
        FileNotFoundException - if the file could not be found on open
      • FileHandler

        public FileHandler​(String fileName,
                           boolean append)
                    throws FileNotFoundException
        Construct a new instance with the given output file and append setting.
        Parameters:
        fileName - the file name
        append - true to append, false to overwrite
        Throws:
        FileNotFoundException - if the file could not be found on open
    • Method Detail

      • setAppend

        public void setAppend​(boolean append)
        Specify whether to append to the target file.
        Parameters:
        append - true to append, false to overwrite
      • getFile

        public File getFile()
        Get the current output file.
        Returns:
        the file