org.openejb.util
Class FileUtils

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

public class FileUtils
extends java.lang.Object


Constructor Summary
FileUtils(java.lang.String homeDir, java.lang.String defaultDir, java.util.Hashtable env)
           
 
Method Summary
static void copyFile(java.io.File destination, java.io.File source)
          Copies the contents of one file to another.
static void copyFile(java.io.File destination, java.io.File source, boolean deleteSourceFile)
          Copies the contents of one file to another.
static java.io.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 java.io.File createTempDirectory(java.lang.String pathPrefix)
          Creates a string for a temporary directory
 boolean equals(java.lang.Object obj)
           
 java.io.File getDirectory()
           
 java.io.File getDirectory(java.lang.String path)
           
 java.io.File getDirectory(java.lang.String path, boolean create)
          Resolves the specified path relative to the home directory; create it if requested
 java.io.File getFile(java.lang.String path)
           
 java.io.File getFile(java.lang.String path, boolean validate)
           
 void setDirectory(java.io.File dir)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils(java.lang.String homeDir,
                 java.lang.String defaultDir,
                 java.util.Hashtable env)
Method Detail

getDirectory

public java.io.File getDirectory(java.lang.String path)
                          throws java.io.IOException
Throws:
java.io.IOException
See Also:
getDirectory(String, boolean)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getDirectory

public java.io.File getDirectory(java.lang.String path,
                                 boolean create)
                          throws java.io.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:
java.io.IOException

getDirectory

public java.io.File getDirectory()

setDirectory

public void setDirectory(java.io.File dir)

getFile

public java.io.File getFile(java.lang.String path)
                     throws java.io.FileNotFoundException,
                            java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

getFile

public java.io.File getFile(java.lang.String path,
                            boolean validate)
                     throws java.io.FileNotFoundException,
                            java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

createTempDirectory

public static java.io.File createTempDirectory(java.lang.String pathPrefix)
                                        throws java.io.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:
java.io.IOException - if it can't find a unique directory name after many iterations

createTempDirectory

public static java.io.File createTempDirectory()
                                        throws java.io.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:
java.io.IOException - if it can't find a unique directory name after many iterations

copyFile

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

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

copyFile

public static void copyFile(java.io.File destination,
                            java.io.File source,
                            boolean deleteSourceFile)
                     throws java.io.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:
java.io.IOException - Thrown if there is an error copying the file.


Copyright © 1999-2011 OpenEJB. All Rights Reserved.