org.ops4j.io
Class FileUtils

java.lang.Object
  extended by org.ops4j.io.FileUtils

public final class FileUtils
extends Object

Utility methods for manipulation of Files.


Method Summary
static void copyFile(File src, File dest, StreamMonitor monitor)
          Copies a file.
static boolean delete(File file)
          Deletes the file or recursively deletes a directory depending on the file passed.
static File getFileFromClasspath(String filePath)
          Searches the classpath for the file denoted by the file path and returns the corresponding file.
 
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 dest,
                            StreamMonitor monitor)
                     throws IOException,
                            FileNotFoundException
Copies a file.

Parameters:
src - The source file.
dest - The destination file.
monitor - The monitor to use for reporting.
Throws:
IOException - if any underlying I/O problem occurs.
FileNotFoundException - if the source file does not exist.

getFileFromClasspath

public static File getFileFromClasspath(String filePath)
                                 throws FileNotFoundException
Searches the classpath for the file denoted by the file path and returns the corresponding file.

Parameters:
filePath - path to the file
Returns:
a file corresponding to the path
Throws:
FileNotFoundException - if the file cannot be found

delete

public static boolean delete(File file)
Deletes the file or recursively deletes a directory depending on the file passed.

Parameters:
file - file or directory to be deleted.
Returns:
true if the file was deleted.


Copyright © 2006-2013 OPS4J - Open Participation Software for Java. All Rights Reserved.