de.vdheide.utils
Class File

java.lang.Object
  extended byde.vdheide.utils.File

public class File
extends java.lang.Object

Various methods for file manipulation and access.

Author:
Jens Vonderheide

Method Summary
static void copy(java.lang.String source, java.lang.String dest)
          Copy from source to destination
static java.io.File getTempFile(java.lang.String id, java.io.File near)
          Create a uniquely named temporary file in the form XXXnnnnn.tmp.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copy

public static void copy(java.lang.String source,
                        java.lang.String dest)
                 throws java.io.IOException
Copy from source to destination

Parameters:
source - Source file
dest - Destination file (no directory!)
Throws:
java.io.IOException

getTempFile

public static java.io.File getTempFile(java.lang.String id,
                                       java.io.File near)
                                throws java.io.IOException
Create a uniquely named temporary file in the form XXXnnnnn.tmp.

Parameters:
id - a string prepended on the file generated. Should you fail to delete it later, the id will help identify where it came from. null and "" also allowed.
near - Directory to create file in. Can also be a file, then temporary file is created in same directory.

If null, one of these locations is used (sorted by preference):

  1. /tmp
  2. /var/tmp
  3. c:/temp
  4. c:/windows/temp
  5. /
  6. current directory
Returns:
a temporary File with a unique name in the form XXXnnnnn.tmp.
Throws:
java.io.IOException