Package adams.core.io

Class TempUtils


  • public class TempUtils
    extends Object
    Functionality related to temporary directory and temporary files.
    The temp directory can be overridden using the PROPERTY_TMPDIR property.
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • PROPERTY_TMPDIR

        public static final String PROPERTY_TMPDIR
        property indicating the temp directory to use.
        See Also:
        Constant Field Values
      • m_TempDir

        protected static String m_TempDir
        the temporary directory.
    • Constructor Detail

      • TempUtils

        public TempUtils()
    • Method Detail

      • createTempFile

        public static File createTempFile​(PlaceholderDirectory dir,
                                          String prefix,
                                          String suffix)
        Creates a temp file name in the specified directory.
        Parameters:
        dir - the directory for the temp file, use null for user's temp dir
        prefix - the prefix for the name, can be null
        suffix - the suffix, eg the extension (must incl dot), can be null
        Returns:
        the generated file name
      • createTempFile

        public static File createTempFile​(String prefix,
                                          String suffix)
        Creates a temp file name in the user's temp directory.
        Parameters:
        prefix - the prefix for the name, can be null
        suffix - the suffix, eg the extension (must incl dot), can be null
        Returns:
        the generated file name
      • createTempFile

        public static File createTempFile​(String file)
        Assembles a temp file in the user's temp directory.
        Parameters:
        file - the file (w/o path) to place in the temp directory
        Returns:
        the generated file name
      • getTempDirectoryStr

        public static String getTempDirectoryStr()
        Returns the temporary directory as string.
        Returns:
        the temp directory
      • getTempDirectory

        public static File getTempDirectory()
        Returns the temporary directory.
        Returns:
        the temp directory