|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.springsource.util.io.FileSystemUtils
public final class FileSystemUtils
Utility methods for dealing with the file system.
Concurrent Semantics
Field Summary | |
---|---|
private static java.lang.String |
URI_FILE_SCHEME
|
Constructor Summary | |
---|---|
private |
FileSystemUtils()
|
Method Summary | |
---|---|
static java.lang.String |
convertToCanonicalPath(java.lang.String path)
Alias for convertToCanonicalPath(path, false) . |
static java.lang.String |
convertToCanonicalPath(java.lang.String path,
boolean verifyPathIsDirectory)
Converts the supplied path to a canonical path , wrapping any
IOExceptions in a FatalIOException . |
static java.lang.String |
convertToCanonicalPath(java.net.URI uri)
Converts the supplied URI to a canonical path , wrapping any
IOExceptions in a FatalIOException . |
static java.lang.String |
createDirectoryIfNecessary(java.lang.String path)
Verifies that the directory with the supplied path exists, and if it does not exist, an attempt
will be made to create it as well as any necessary parent directories. |
static boolean |
deleteRecursively(java.io.File root)
Delete the supplied File and, for directories, recursively delete any nested directories or files. |
static boolean |
deleteRecursively(java.lang.String path)
Delete the file referenced by the supplied path and, if the path refers to a directory, recursively delete any nested directories or files. |
private static boolean |
doRecursiveDelete(java.io.File root)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String URI_FILE_SCHEME
Constructor Detail |
---|
private FileSystemUtils()
Method Detail |
---|
public static java.lang.String convertToCanonicalPath(java.lang.String path) throws FatalIOException
convertToCanonicalPath(path, false)
.
path
- the path to convert; may be null
null
if the supplied path was null
FatalIOException
- if a lower-level IOException
is thrown.convertToCanonicalPath(String, boolean)
public static java.lang.String convertToCanonicalPath(java.lang.String path, boolean verifyPathIsDirectory) throws FatalIOException
path
to a canonical path
, wrapping any
IOExceptions
in a FatalIOException
.
path
- the path to convert; may be null
verifyPathIsDirectory
- true
if the path should only refer to a directory
null
if the supplied path was null
FatalIOException
- if verifyPathIsDirectory
is true
and the supplied path is not a directory, or a lower-level IOException
is thrown.public static java.lang.String convertToCanonicalPath(java.net.URI uri) throws FatalIOException
URI
to a canonical path
, wrapping any
IOExceptions
in a FatalIOException
.
uri
- the path to convert; may be null
null
if the supplied URI
was null
FatalIOException
- if a lower-level IOException
is thrown.public static java.lang.String createDirectoryIfNecessary(java.lang.String path)
path
exists, and if it does not exist, an attempt
will be made to create it as well as any necessary parent directories. As a convenience, the supplied path will
be converted
to a canonical path and returned.
path
- the directory path; must not be null
public static boolean deleteRecursively(java.io.File root)
File
and, for directories, recursively delete any nested directories or files.
root
- the root File
to delete.
true
if the File
was deleted, otherwise false
.deleteRecursively(String)
public static boolean deleteRecursively(java.lang.String path)
path
- the path to the file or directory to delete.
true
if the file or directory was deleted, otherwise false
.deleteRecursively(File)
private static boolean doRecursiveDelete(java.io.File root)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |