Package org.elasticsearch.common.io
Class FileSystemUtils
org.elasticsearch.common.io.FileSystemUtils
public final class FileSystemUtils
extends
Elasticsearch utils to work with
-
Method Summary
Modifier and TypeMethodDescriptionstatic
base, path, int strip)
Appends the path to the given base and strips N elements off the path if strip is > 0.static void
... paths)
Deletes all subdirectories in the given path recursivelystatic boolean
... files)
Returnstrue
iff one of the files exists otherwisefalse
static []
directory)
Returns an array of all files in the given directory.static []
directory, glob)
Returns an array of all files in the given directory matching the glob.static []
from, <> filter)
Returns an array of all files in the given directory matching.static boolean
directory, org.apache.logging.log4j.Logger logger)
Check that a directory exists, is a directory and is readable by the current userstatic boolean
path)
Check whether the file denoted by the given path is a desktop services store created by Finder on macOS.static boolean
path)
Check whether the file denoted by the given path is hidden.static
url)
Returns an InputStream the given url if the url has a protocol of 'file' or 'jar', no host, and no port.Methods inherited from class java.lang.
, , , , , , , , , ,
-
Method Details
-
exists
public static boolean exists(... files)Returnstrue
iff one of the files exists otherwisefalse
-
isHidden
public static boolean isHidden( path)Check whether the file denoted by the given path is hidden. In practice, this will check if the file name starts with a dot. This should be preferred to as this does not depend on the operating system. -
isDesktopServicesStore
public static boolean isDesktopServicesStore( path)Check whether the file denoted by the given path is a desktop services store created by Finder on macOS.- Parameters:
path
- the path- Returns:
- true if the current system is macOS and the specified file appears to be a desktop services store file
-
append
public static append( base, path, int strip)Appends the path to the given base and strips N elements off the path if strip is > 0. -
deleteSubDirectories
public static void deleteSubDirectories(... paths) throwsDeletes all subdirectories in the given path recursively- Throws:
- if the given path is not a directory
-
isAccessibleDirectory
public static boolean isAccessibleDirectory( directory, org.apache.logging.log4j.Logger logger)Check that a directory exists, is a directory and is readable by the current user -
openFileURLStream
public static openFileURLStream( url) throwsReturns an InputStream the given url if the url has a protocol of 'file' or 'jar', no host, and no port.- Throws:
-
files
public static [] files( from, <> filter) throwsReturns an array of all files in the given directory matching.- Throws:
-
files
public static [] files( directory) throwsReturns an array of all files in the given directory.- Throws:
-
files
public static [] files( directory, glob) throwsReturns an array of all files in the given directory matching the glob.- Throws:
-