Package org.dbunit.util
Class FileHelper
java.lang.Object
org.dbunit.util.FileHelper
Utility that provides some general methods for working with
File objects.- Since:
- 2.3.0
- Version:
- $Revision$
- Author:
- gommma
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidCopy file.static InputSourcecreateInputSource(File file) Creates anInputSourcefor the given file.static booleandeleteDirectory(File directory) Recursively deletes the given directorystatic voiddeleteDirectory(File directory, boolean failOnError) Recursively deletes the given directorystatic ListGet a list of Strings from a given file.
-
Method Details
-
deleteDirectory
Recursively deletes the given directory- Parameters:
directory- The directory to deletefailOnError- If an exception should be thrown in case the deletion did not work.
-
deleteDirectory
Recursively deletes the given directory- Parameters:
directory- The directory to delete- Returns:
trueif the deletion was successfully.
-
createInputSource
Creates anInputSourcefor the given file.- Parameters:
file- the file to create anInputSourcefor.- Returns:
- the input source for the given file.
- Throws:
MalformedURLException- if the file's path cannot be converted to a URL.
-
copyFile
Copy file.- Parameters:
srcFile- the src filedestFile- the dest file- Throws:
IOException- if copying the file fails.
-
readLines
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- if the file cannot be read.
-