org.dbunit.util
Class FileHelper

java.lang.Object
  extended by org.dbunit.util.FileHelper

public class FileHelper
extends Object

Utility that provides some general methods for working with File objects.

Since:
2.3.0
Version:
$Revision: 884 $
Author:
gommma

Method Summary
static void copyFile(File srcFile, File destFile)
          Copy file.
static InputSource createInputSource(File file)
           
static boolean deleteDirectory(File directory)
          Recursively deletes the given directory
static void deleteDirectory(File directory, boolean failOnError)
          Recursively deletes the given directory
static List readLines(File theFile)
          Get a list of Strings from a given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

deleteDirectory

public static void deleteDirectory(File directory,
                                   boolean failOnError)
Recursively deletes the given directory

Parameters:
directory - The directory to delete
failOnError - If an exception should be thrown in case the deletion did not work.

deleteDirectory

public static boolean deleteDirectory(File directory)
Recursively deletes the given directory

Parameters:
directory - The directory to delete
Returns:
true if the deletion was successfully.

createInputSource

public static InputSource createInputSource(File file)
                                     throws MalformedURLException
Throws:
MalformedURLException

copyFile

public static void copyFile(File srcFile,
                            File destFile)
                     throws IOException
Copy file.

Parameters:
srcFile - the src file
destFile - the dest file
Throws:
IOException

readLines

public static List readLines(File theFile)
                      throws IOException
Get a list of Strings from a given file. Uses the default encoding of the current platform.

Parameters:
theFile - the file to be read
Returns:
a list of Strings, each one representing one line from the given file
Throws:
IOException


Copyright © 2002-2012. All Rights Reserved.