@Immutable public class FileUtil extends Object
Constructor and Description |
---|
FileUtil() |
Modifier and Type | Method and Description |
---|---|
static URL |
convertFileToURL(String filePath)
|
static int |
copy(File sourceFileOrDirectory,
File destinationFileOrDirectory)
Copy the source file system structure into the supplied target location.
|
static int |
copy(File sourceFileOrDirectory,
File destinationFileOrDirectory,
FilenameFilter exclusionFilter)
Copy the source file system structure into the supplied target location.
|
static boolean |
delete(File fileOrDirectory)
Delete the file or directory given by the supplied reference.
|
static boolean |
delete(String path)
Delete the file or directory at the supplied path.
|
public static boolean delete(String path)
File.delete()
method.path
- the path to the file or directory that is to be deletedpublic static boolean delete(File fileOrDirectory)
File.delete()
method.fileOrDirectory
- the reference to the Java File object that is to be deletedpublic static int copy(File sourceFileOrDirectory, File destinationFileOrDirectory) throws IOException
sourceFileOrDirectory
- the file or directory whose contents are to be copied into the target locationdestinationFileOrDirectory
- the location where the copy is to be placed; does not need to exist, but if it does its
type must match that of src
IllegalArgumentException
- if the src
or dest
references are nullIOException
public static int copy(File sourceFileOrDirectory, File destinationFileOrDirectory, FilenameFilter exclusionFilter) throws IOException
sourceFileOrDirectory
- the file or directory whose contents are to be copied into the target locationdestinationFileOrDirectory
- the location where the copy is to be placed; does not need to exist, but if it does its
type must match that of src
exclusionFilter
- a filter that matches files or folders that should _not_ be copied; null indicates that all files
and folders should be copiedIllegalArgumentException
- if the src
or dest
references are nullIOException
public static URL convertFileToURL(String filePath) throws MalformedURLException
filePath
- the path of the fileURL
representation of the file.MalformedURLException
IllegalArgumentException
- if the file path is null, empty or blankCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.