org.jboss.dna.common.util
Class FileUtil
java.lang.Object
org.jboss.dna.common.util.FileUtil
public class FileUtil
- extends Object
Method Summary |
static URL |
convertFileToURL(String filePath)
Utility to convert File to URL . |
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. |
FileUtil
public FileUtil()
delete
public static boolean delete(String path)
- Delete the file or directory at the supplied path. This method works on a directory that is not empty, unlike the
File.delete()
method.
- Parameters:
path
- the path to the file or directory that is to be deleted
- Returns:
- true if the file or directory at the supplied path existed and was successfully deleted, or false otherwise
delete
public static boolean delete(File fileOrDirectory)
- Delete the file or directory given by the supplied reference. This method works on a directory that is not empty, unlike
the
File.delete()
method.
- Parameters:
fileOrDirectory
- the reference to the Java File object that is to be deleted
- Returns:
- true if the supplied file or directory existed and was successfully deleted, or false otherwise
convertFileToURL
public static URL convertFileToURL(String filePath)
throws MalformedURLException
- Utility to convert
File
to URL
.
- Parameters:
filePath
- the path of the file
- Returns:
- the
URL
representation of the file.
- Throws:
MalformedURLException
IllegalArgumentException
- if the file path is null, empty or blank
Copyright © 2008-Present JBoss a division of Red Hat. All Rights Reserved.