| Modifier and Type | Method and Description |
|---|---|
static Path |
append(Path base,
Path path,
int strip)
Appends the path to the given base and strips N elements off the path if strip is > 0.
|
static void |
copyDirectoryRecursively(Path source,
Path destination)
Copy recursively a dir to a new location
|
static void |
deleteSubDirectories(Path... paths)
Deletes all subdirectories in the given path recursively
|
static boolean |
exists(Path... files)
Returns
true iff one of the files exists otherwise false |
static Path[] |
files(Path directory)
Returns an array of all files in the given directory.
|
static Path[] |
files(Path from,
DirectoryStream.Filter<Path> filter)
Returns an array of all files in the given directory matching.
|
static Path[] |
files(Path directory,
String glob)
Returns an array of all files in the given directory matching the glob.
|
static boolean |
hasExtensions(Path root,
String... extensions)
Returns
true iff a file under the given root has one of the given extensions. |
static boolean |
isAccessibleDirectory(Path directory,
ESLogger logger)
Check that a directory exists, is a directory and is readable
by the current user
|
static boolean |
isHidden(Path path)
Check whether the file denoted by the given path is hidden.
|
static void |
move(Path source,
Path destination)
Move or rename a file to a target file.
|
static void |
moveFilesWithoutOverwriting(Path source,
Path destination,
String suffix)
This utility copy a full directory content (excluded) under
a new directory but without overwriting existing files.
|
static BufferedReader |
newBufferedReader(URL url,
Charset cs)
Opens the given url for reading returning a
BufferedReader that may be
used to read text from the URL in an efficient manner. |
public static boolean hasExtensions(Path root, String... extensions) throws IOException
true iff a file under the given root has one of the given extensions. This method
will travers directories recursively and will terminate once any of the extensions was found. This
methods will not follow any links.root - the root directory to travers. Must be a directoryextensions - the file extensions to look fortrue iff a file under the given root has one of the given extensions, otherwise falseIOException - if an IOException occurs or if the given root path is not a directory.public static boolean exists(Path... files)
true iff one of the files exists otherwise falsepublic static boolean isHidden(Path path)
Files.isHidden(Path) as this
does not depend on the operating system.public static Path append(Path base, Path path, int strip)
public static void deleteSubDirectories(Path... paths) throws IOException
IllegalArgumentException - if the given path is not a directoryIOExceptionpublic static boolean isAccessibleDirectory(Path directory, ESLogger logger)
public static BufferedReader newBufferedReader(URL url, Charset cs) throws IOException
BufferedReader that may be
used to read text from the URL in an efficient manner. Bytes from the
file are decoded into characters using the specified charset.IOExceptionpublic static void moveFilesWithoutOverwriting(Path source, Path destination, String suffix) throws IOException
source - Source directory (for example /tmp/es/src)destination - Destination directory (destination directory /tmp/es/dst)suffix - When not null, files are copied with a suffix appended to the original name (eg: ".new")
When null, files are ignoredIOExceptionpublic static void copyDirectoryRecursively(Path source, Path destination) throws IOException
source - source dirdestination - destination dirIOExceptionpublic static void move(Path source, Path destination) throws IOException
source - source filedestination - destination fileIOExceptionpublic static Path[] files(Path from, DirectoryStream.Filter<Path> filter) throws IOException
IOExceptionpublic static Path[] files(Path directory) throws IOException
IOExceptionpublic static Path[] files(Path directory, String glob) throws IOException
IOExceptionCopyright © 2009–2017. All rights reserved.