public interface FileUtils
| 限定符和类型 | 字段和说明 |
|---|---|
static org.slf4j.Logger |
LOG |
static int |
NUM_ATTEMPTS |
static TimeDuration |
SLEEP_TIME |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> T |
attempt(CheckedSupplier<T,IOException> op,
Supplier<?> name) |
static void |
createDirectories(File dir) |
static void |
createDirectories(Path dir) |
static void |
createDirectoriesDeleteExistingNonDirectory(File dir) |
static void |
createDirectoriesDeleteExistingNonDirectory(Path dir) |
static OutputStream |
createNewFile(Path p) |
static void |
delete(Path p)
Use
Files.delete(Path) to delete the given path. |
static void |
deleteFile(File f)
The same as passing f.toPath() to
delete(Path). |
static boolean |
deleteFileQuietly(File f)
The same as passing f.toPath() to
deletePathQuietly(Path). |
static void |
deleteFully(File f)
The same as passing f.toPath() to
deleteFully(Path). |
static void |
deleteFully(Path p)
Delete fully the given path
|
static boolean |
deletePathQuietly(Path p)
Delete the given path quietly.
|
static void |
move(File src,
File dst) |
static File |
move(File src,
String suffix)
Move src to a new path,
where the new path created by appending the given suffix to the src.
|
static void |
move(Path src,
Path dst) |
static void |
moveDirectory(Path source,
Path dest)
Moves the directory.
|
static void |
truncateFile(File f,
long target) |
static final org.slf4j.Logger LOG
static final int NUM_ATTEMPTS
static final TimeDuration SLEEP_TIME
static <T> T attempt(CheckedSupplier<T,IOException> op, Supplier<?> name) throws IOException
IOExceptionstatic void truncateFile(File f, long target) throws IOException
IOExceptionstatic OutputStream createNewFile(Path p) throws IOException
IOExceptionstatic void createDirectories(File dir) throws IOException
IOExceptionstatic void createDirectories(Path dir) throws IOException
IOExceptionstatic void createDirectoriesDeleteExistingNonDirectory(File dir) throws IOException
IOExceptionstatic void createDirectoriesDeleteExistingNonDirectory(Path dir) throws IOException
IOExceptionstatic void move(File src, File dst) throws IOException
IOExceptionstatic void move(Path src, Path dst) throws IOException
IOExceptionstatic File move(File src, String suffix) throws IOException
IOExceptionstatic void deleteFile(File f) throws IOException
delete(Path).IOExceptionstatic void moveDirectory(Path source, Path dest) throws IOException
source - dest - IOExceptionstatic boolean deleteFileQuietly(File f)
deletePathQuietly(Path).f - file to deletestatic boolean deletePathQuietly(Path p)
p - path to deletestatic void delete(Path p) throws IOException
Files.delete(Path) to delete the given path.
This method may print log messages using LOG.IOExceptionstatic void deleteFully(File f) throws IOException
deleteFully(Path).IOExceptionstatic void deleteFully(Path p) throws IOException
IOExceptionCopyright © 2017–2023 The Apache Software Foundation. All rights reserved.