org.openejb.util
Class FileUtils

java.lang.Object
  extended by org.openejb.util.FileUtils

public class FileUtils
extends Object


Constructor Summary
FileUtils(String homeDir, String defaultDir, Hashtable env)
           
 
Method Summary
static void copyFile(File destination, File source)
          Copies the contents of one file to another.
static void copyFile(File destination, File source, boolean deleteSourceFile)
          Copies the contents of one file to another.
static File createTempDirectory()
          Creates a string for a temporary directory The path prefix is chosen from the system property "java.io.tmpdir" plus a file separator plus the string "openejb" @returns the file object associated with the unique name
static File createTempDirectory(String pathPrefix)
          Creates a string for a temporary directory
 boolean equals(Object obj)
           
 File getDirectory()
           
 File getDirectory(String path)
           
 File getDirectory(String path, boolean create)
          Resolves the specified path relative to the home directory; create it if requested
 File getFile(String path)
           
 File getFile(String path, boolean validate)
           
 void setDirectory(File dir)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils(String homeDir,
                 String defaultDir,
                 Hashtable env)
Method Detail

getDirectory

public File getDirectory(String path)
                  throws IOException
Throws:
IOException
See Also:
getDirectory(String, boolean)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getDirectory

public File getDirectory(String path,
                         boolean create)
                  throws IOException
Resolves the specified path relative to the home directory; create it if requested

Parameters:
path - relative path to the home directory
create - shall the directory be created if it doesn't exist?
Returns:
directory
Throws:
IOException

getDirectory

public File getDirectory()

setDirectory

public void setDirectory(File dir)

getFile

public File getFile(String path)
             throws FileNotFoundException,
                    IOException
Throws:
FileNotFoundException
IOException

getFile

public File getFile(String path,
                    boolean validate)
             throws FileNotFoundException,
                    IOException
Throws:
FileNotFoundException
IOException

createTempDirectory

public static File createTempDirectory(String pathPrefix)
                                throws IOException
Creates a string for a temporary directory

Parameters:
pathPrefix - the path prefix to for the directory, e.g. /tmp/openejb @returns the file object associated with the unique name
Throws:
IOException - if it can't find a unique directory name after many iterations

createTempDirectory

public static File createTempDirectory()
                                throws IOException
Creates a string for a temporary directory The path prefix is chosen from the system property "java.io.tmpdir" plus a file separator plus the string "openejb" @returns the file object associated with the unique name

Throws:
IOException - if it can't find a unique directory name after many iterations

copyFile

public static void copyFile(File destination,
                            File source)
                     throws IOException
Copies the contents of one file to another.

Parameters:
destination - Destination file
source - Source file
Throws:
IOException - Thrown if there is an error copying the file.

copyFile

public static void copyFile(File destination,
                            File source,
                            boolean deleteSourceFile)
                     throws IOException
Copies the contents of one file to another.

Parameters:
destination - Destination file
source - Source file
deleteSourceFile - whether or not to delete the source file
Throws:
IOException - Thrown if there is an error copying the file.


Copyright © 1999-2012 OpenEJB. All Rights Reserved.