fedora.utilities
Class FileUtils

java.lang.Object
  extended by fedora.utilities.FileUtils

public class FileUtils
extends java.lang.Object


Field Summary
static int BUFFER
           
 
Constructor Summary
FileUtils()
           
 
Method Summary
static boolean copy(java.io.File source, java.io.File destination)
          Copy a file or directory.
static boolean copy(java.io.InputStream source, java.io.OutputStream destination)
          Copy an InputStream to an OutputStream.
static boolean delete(java.io.File file)
          Delete a File.
static boolean delete(java.lang.String file)
          Delete the specified file or directory.
static java.io.FileFilter getPrefixFileFilter(java.lang.String prefix)
           
static java.io.FileFilter getSuffixFileFilter(java.lang.String suffix)
           
static java.util.Properties loadProperties(java.io.File f)
          Load properties from the given file.
static boolean move(java.io.File source, java.io.File destination)
          Move a file or directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER

public static final int BUFFER
See Also:
Constant Field Values
Constructor Detail

FileUtils

public FileUtils()
Method Detail

copy

public static boolean copy(java.io.InputStream source,
                           java.io.OutputStream destination)
Copy an InputStream to an OutputStream.

Parameters:
source -
destination -
Returns:
true if the operation was successful; false otherwise (which includes a null input).

copy

public static boolean copy(java.io.File source,
                           java.io.File destination)
Copy a file or directory.

Parameters:
source -
destination -
Returns:
true if the operation was successful; false otherwise (which includes a null input).

delete

public static boolean delete(java.io.File file)
Delete a File.

Parameters:
file - the File to delete.
Returns:
true if the operation was successful; false otherwise (which includes a null input).

delete

public static boolean delete(java.lang.String file)
Delete the specified file or directory.

Parameters:
file - File or directory to delete
Returns:
true if the operation was successful; false otherwise (which includes a null input).

move

public static boolean move(java.io.File source,
                           java.io.File destination)
Move a file or directory. Initally attempts to move the File using java.io.File.renameTo(). However, should this operation fail (e.g. when source and destination are across different filesystems), will attempt to copy and then delete the source.

Parameters:
source -
destination -
Returns:
true if the operation was successful; false otherwise (which includes a null input).

loadProperties

public static java.util.Properties loadProperties(java.io.File f)
                                           throws java.io.IOException
Load properties from the given file.

Throws:
java.io.IOException

getPrefixFileFilter

public static java.io.FileFilter getPrefixFileFilter(java.lang.String prefix)

getSuffixFileFilter

public static java.io.FileFilter getSuffixFileFilter(java.lang.String suffix)