org.apache.commons.transaction.util
Class FileHelper

java.lang.Object
  extended by org.apache.commons.transaction.util.FileHelper

public final class FileHelper
extends Object

Helper methods for file manipulation. All methods are thread safe.

Version:
$Id: FileHelper.java 493628 2007-01-07 01:42:48Z joerg $

Constructor Summary
FileHelper()
           
 
Method Summary
static void copy(File sourceFile, File destinationFile)
           
static void copyRecursive(File source, File target)
           
static boolean deleteFile(String path)
          Deletes a file specified by a path.
static boolean fileExists(String path)
          Checks if a file specified by a path exits.
static File makeBackup(File file, File backupDirectory, boolean moveAllowed)
           
static boolean move(File sourceFile, File destinationFile)
           
static void moveRecursive(File source, File target)
           
static byte[] readInto(File file)
           
static void removeRecursive(File toRemove)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileHelper

public FileHelper()
Method Detail

makeBackup

public static File makeBackup(File file,
                              File backupDirectory,
                              boolean moveAllowed)
                       throws IOException
Throws:
IOException

readInto

public static byte[] readInto(File file)
                       throws IOException
Throws:
IOException

copy

public static void copy(File sourceFile,
                        File destinationFile)
                 throws IOException
Throws:
IOException

move

public static boolean move(File sourceFile,
                           File destinationFile)
                    throws IOException
Throws:
IOException

deleteFile

public static boolean deleteFile(String path)
Deletes a file specified by a path.

Parameters:
path - path of file to be deleted
Returns:
true if file has been deleted, false otherwise

fileExists

public static boolean fileExists(String path)
Checks if a file specified by a path exits.

Parameters:
path - path of file to be checked
Returns:
true if file exists, false otherwise

copyRecursive

public static void copyRecursive(File source,
                                 File target)
                          throws IOException
Throws:
IOException

moveRecursive

public static void moveRecursive(File source,
                                 File target)
                          throws IOException
Throws:
IOException

removeRecursive

public static void removeRecursive(File toRemove)


Copyright © 2004-2007 The Apache Software Foundation. All Rights Reserved.