Class FileSystemUtils


  • public final class FileSystemUtils
    extends Object
    Elasticsearch utils to work with Path
    • Method Detail

      • exists

        public static boolean exists​(Path... files)
        Returns true iff one of the files exists otherwise false
      • isHidden

        public static boolean isHidden​(Path 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 Files.isHidden(Path) as this does not depend on the operating system.
      • isDesktopServicesStore

        public static boolean isDesktopServicesStore​(Path 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 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.
      • isAccessibleDirectory

        public static boolean isAccessibleDirectory​(Path 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 InputStream openFileURLStream​(URL url)
                                             throws IOException
        Returns an InputStream the given url if the url has a protocol of 'file' or 'jar', no host, and no port.
        Throws:
        IOException
      • files

        public static Path[] files​(Path directory,
                                   String glob)
                            throws IOException
        Returns an array of all files in the given directory matching the glob.
        Throws:
        IOException