Class FileTarget

    • Field Detail

      • m_file

        private java.io.File m_file
      • m_append

        private boolean m_append
    • Constructor Detail

      • FileTarget

        public FileTarget​(java.io.File file,
                          boolean append,
                          Formatter formatter)
                   throws java.io.IOException
        Construct file target to write to a file with a formatter.
        Parameters:
        file - the file to write to
        append - true if file is to be appended to, false otherwise
        formatter - the Formatter
        Throws:
        java.io.IOException - if an error occurs
    • Method Detail

      • setFile

        protected void setFile​(java.io.File file,
                               boolean append)
                        throws java.io.IOException
        Set the file for this target.
        Parameters:
        file - the file to write to
        append - true if file is to be appended to, false otherwise
        Throws:
        java.io.IOException - if directories can not be created or file can not be opened
      • openFile

        protected void openFile()
                         throws java.io.IOException
        Open underlying file and allocate resources. This method will attempt to create directories below file and append to it if specified.
        Throws:
        java.io.IOException - if directories can not be created or file can not be opened
      • getFile

        protected java.io.File getFile()
        Retrieve file associated with target. This allows subclasses to access file object.
        Returns:
        the output File