public class FileHelper
extends java.lang.Object
| Constructor and Description |
|---|
FileHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
copy(java.nio.file.Path source,
java.nio.file.Path destination)
Copies a path within the filesystem
If the path is a directory its contents
will be recursively copied.
|
static boolean |
deleteQuietly(java.nio.file.Path path) |
static void |
ensureDir(java.nio.file.Path dir)
Create a directory if it does not exist yet.
|
static boolean |
isEmpty(java.nio.file.Path directory) |
static java.util.List<java.nio.file.Path> |
list(java.nio.file.Path directory)
A list of the entries in the directory.
|
static java.nio.file.Path |
makeTempDir(java.lang.String prefix,
java.nio.file.Path parent)
Create a new directory within
parent. |
static void |
renameTmpDir(java.nio.file.Path from,
java.nio.file.Path to) |
public static void ensureDir(java.nio.file.Path dir)
throws PackageException
dir - the directory pathPackageException - if an error occurspublic static java.nio.file.Path makeTempDir(java.lang.String prefix,
java.nio.file.Path parent)
throws PackageException
parent.
The new directory is empty, and its name is based on prefix,
and on the current date after the prefix.prefix - the prefix for the temporary directoryparent - the directory in which to create the temporary directoryPackageException - if an error occurspublic static void renameTmpDir(java.nio.file.Path from,
java.nio.file.Path to)
throws PackageException
PackageExceptionpublic static void copy(java.nio.file.Path source,
java.nio.file.Path destination)
throws java.io.IOException
source - the source file or directorydestination - the destination file or directoryjava.io.IOException - if an error occurs whilst copying a file or directorypublic static boolean deleteQuietly(java.nio.file.Path path)
public static java.util.List<java.nio.file.Path> list(java.nio.file.Path directory)
throws java.io.IOException
directory - The directory to list the entries forjava.io.IOException - if the an error occurs whilst listing the directoriespublic static boolean isEmpty(java.nio.file.Path directory)
Copyright © 2015-2023 EXPath. All Rights Reserved