|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.io.FileHelper
public class FileHelper
A Collection of helper methods for files.
Constructor Summary | |
---|---|
FileHelper() |
Method Summary | |
---|---|
static long |
calculateDirectoryUsage(java.io.File fileDir, boolean fRecurse) Return the approximate disk usage in bytes for a given directory optionally including sub-dirs. |
static void |
copyDir(java.io.File fileDirFrom, java.io.File fileDirTo, java.io.FileFilter filter) Create a deep copy of the specified directory into the specified target directory. |
static void |
copyFile(java.io.File fileFrom, java.io.File fileTo) Copy the specified file according to the source and destination File objects preserving the time-stamp of the source. |
static java.io.File |
createTempDir() Create a unique temporary directory. |
static void |
deleteDir(java.io.File fileDir) Delete a directory recursively. |
static java.io.File |
ensureDir(java.io.File file) Validate that the given File represents a directory, creating it if it doesn't already exist. |
static boolean |
isSymlink(java.io.File file) Determine whether the specified file is a symbolic link rather than an actual file. |
static boolean |
isWindows() Determine if a Windows file system is in use. |
static java.nio.channels.FileLock |
lockFile(java.io.File file) Obtain an exclusive lock on the specified file. |
static void |
moveDir(java.io.File fileDirFrom, java.io.File fileDirTo) Move the specified directory to the specified destination path. |
static void |
moveFile(java.io.File fileFrom, java.io.File fileTo) Move the specified file to the specified destination path. |
static java.lang.String |
toFilename(java.lang.String sName) Given a string, return a derivative version that is safe to use for a filename. |
static void |
unlockFile(java.nio.channels.FileLock lock) Release an exclusive lock on a file. |
Constructor Detail |
---|
public FileHelper()
Method Detail |
---|
public static boolean isWindows()
public static java.lang.String toFilename(java.lang.String sName)
sName
- the stringpublic static boolean isSymlink(java.io.File file) throws java.io.IOException
file
- the file to checkjava.io.IOException
- if an IO error occurs while checking the filepublic static java.io.File createTempDir()
public static java.io.File ensureDir(java.io.File file) throws java.io.IOException
file
- the File to checkjava.io.IOException
public static void copyDir(java.io.File fileDirFrom, java.io.File fileDirTo, java.io.FileFilter filter) throws java.io.IOException
fileDirFrom
- the directory to copy fromfileDirTo
- the directory to copy intofilter
- an optional filter that can be used to filter out files from the copy operationjava.io.IOException
- if an error occurred copying the directorypublic static void deleteDir(java.io.File fileDir) throws java.io.IOException
fileDir
- directory to deletejava.io.IOException
- if an error occurred deleting the directorypublic static void moveDir(java.io.File fileDirFrom, java.io.File fileDirTo) throws java.io.IOException
fileDirFrom
- the directory to movefileDirTo
- the destination pathjava.io.IOException
- if an error occurred moving the directorypublic static java.nio.channels.FileLock lockFile(java.io.File file)
unlockFile
method.file
- the file to lockpublic static void unlockFile(java.nio.channels.FileLock lock)
exclusive lock
on a file.lock
- the exclusive lock
to releasepublic static void copyFile(java.io.File fileFrom, java.io.File fileTo) throws java.io.IOException
fileFrom
- the File
to copy fromfileTo
- the File
to copy tojava.io.IOException
- if an error occurred copying the filepublic static void moveFile(java.io.File fileFrom, java.io.File fileTo) throws java.io.IOException
fileFrom
- the file to movefileTo
- the destination pathjava.io.IOException
- if an error occurred moving the filepublic static long calculateDirectoryUsage(java.io.File fileDir, boolean fRecurse)
fileDir
- the directory to interrogatefRecurse
- indicates if we should recurse through sub-directories that are found
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |