org.openejb.util
Class FileUtils

java.lang.Object
  extended byorg.openejb.util.FileUtils

public class FileUtils
extends Object


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
static FileUtils getBase()
           
 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)
           
static FileUtils getHome()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBase

public static FileUtils getBase()

getHome

public static FileUtils getHome()

getDirectory

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

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()

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-2005 OpenEJB. All Rights Reserved.