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 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 void |
deleteFileQuietly(File f)
The same as passing f.toPath() to
delete(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 void |
move(File src,
File dst) |
static void |
move(Path src,
Path dst) |
static void |
moveDirectory(Path source,
Path dest)
Moves the directory.
|
static void |
renameFileToCorrupt(File tmpSnapshotFile) |
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 move(File src, File dst) throws IOException
IOExceptionstatic void move(Path src, Path dst) throws IOException
IOExceptionstatic void deleteFile(File f) throws IOException
delete(Path).IOExceptionstatic void moveDirectory(Path source, Path dest) throws IOException
source - dest - IOExceptionstatic void deleteFileQuietly(File f)
delete(Path).static 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
IOExceptionstatic void renameFileToCorrupt(File tmpSnapshotFile)
Copyright © 2017–2021 The Apache Software Foundation. All rights reserved.