ch.javasoft.io
Class Files

java.lang.Object
  extended by ch.javasoft.io.Files

public class Files
extends Object

Utility class with static methods for file handling, e.g. copying files


Method Summary
static void copyFile(File src, File dst)
          Copy the given src file to dst
static void deleteRecursive(File dir)
          Deletes the contents of the given directory recursively, but not the directory itself
static String getFileNameStamped()
          Returns a file name created from a time stamp, including date and time up tp milliseconds: yyyy-MM-dd_hh-mm-ss-SSS
static File getTempDir()
          Returns the system temp directory, see SystemProperties.JAVA_IO_TMPDIR
static File getTempFile(String fileName)
          Returns the specified file with system temp directory as parent.
static File getTempFileStamped()
          Returns a stamped file with system temp directory as parent.
static File getUserHome()
          Returns the current user's home directory, see SystemProperties.USER_HOME
static File getUserWorkingDir()
          Returns the user's current working directory directory, see SystemProperties.USER_DIR
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copyFile

public static void copyFile(File src,
                            File dst)
                     throws IOException
Copy the given src file to dst

Throws:
IOException

deleteRecursive

public static void deleteRecursive(File dir)
                            throws IOException
Deletes the contents of the given directory recursively, but not the directory itself

Throws:
IOException - if a file could not be deleted
SecurityException - if a security manager exists and its SecurityManager.checkDelete(java.lang.String) method denies delete access to the file

getTempDir

public static File getTempDir()
Returns the system temp directory, see SystemProperties.JAVA_IO_TMPDIR


getTempFile

public static File getTempFile(String fileName)
Returns the specified file with system temp directory as parent. See also getTempDir() and SystemProperties.JAVA_IO_TMPDIR


getTempFileStamped

public static File getTempFileStamped()
Returns a stamped file with system temp directory as parent. See also getTempDir() and SystemProperties.JAVA_IO_TMPDIR


getFileNameStamped

public static String getFileNameStamped()
Returns a file name created from a time stamp, including date and time up tp milliseconds: yyyy-MM-dd_hh-mm-ss-SSS


getUserHome

public static File getUserHome()
Returns the current user's home directory, see SystemProperties.USER_HOME


getUserWorkingDir

public static File getUserWorkingDir()
Returns the user's current working directory directory, see SystemProperties.USER_DIR