Package oshi.util

Class FileSystemUtil


  • @ThreadSafe
    public final class FileSystemUtil
    extends java.lang.Object
    Utility class for common filesystem code
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String GLOB_PREFIX  
      private static java.lang.String REGEX_PREFIX  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private FileSystemUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isFileStoreExcluded​(java.lang.String path, java.lang.String volume, java.util.List<java.nio.file.PathMatcher> pathIncludes, java.util.List<java.nio.file.PathMatcher> pathExcludes, java.util.List<java.nio.file.PathMatcher> volumeIncludes, java.util.List<java.nio.file.PathMatcher> volumeExcludes)
      Evaluates if file store (identified by path and volume) should be excluded or not based on configuration pathIncludes, pathExcludes, volumeIncludes, volumeExcludes.
      static java.util.List<java.nio.file.PathMatcher> loadAndParseFileSystemConfig​(java.lang.String configPropertyName)
      Load from config and parse file system include/exclude line.
      static boolean matches​(java.nio.file.Path text, java.util.List<java.nio.file.PathMatcher> patterns)
      Checks if text matches any of @param patterns}.
      static java.util.List<java.nio.file.PathMatcher> parseFileSystemConfig​(java.lang.String config)
      Parse file system include/exclude line.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileSystemUtil

        private FileSystemUtil()
    • Method Detail

      • isFileStoreExcluded

        public static boolean isFileStoreExcluded​(java.lang.String path,
                                                  java.lang.String volume,
                                                  java.util.List<java.nio.file.PathMatcher> pathIncludes,
                                                  java.util.List<java.nio.file.PathMatcher> pathExcludes,
                                                  java.util.List<java.nio.file.PathMatcher> volumeIncludes,
                                                  java.util.List<java.nio.file.PathMatcher> volumeExcludes)
        Evaluates if file store (identified by path and volume) should be excluded or not based on configuration pathIncludes, pathExcludes, volumeIncludes, volumeExcludes. Inclusion has priority over exclusion. If no exclusion/inclusion pattern is specified, then filestore is not excluded.
        Parameters:
        path - Mountpoint of filestore.
        volume - Filestore volume.
        pathIncludes - List of patterns for path inclusions.
        pathExcludes - List of patterns for path exclusions.
        volumeIncludes - List of patterns for volume inclusions.
        volumeExcludes - List of patterns for volume exclusions.
        Returns:
        true if file store should be excluded or false otherwise.
      • loadAndParseFileSystemConfig

        public static java.util.List<java.nio.file.PathMatcher> loadAndParseFileSystemConfig​(java.lang.String configPropertyName)
        Load from config and parse file system include/exclude line.
        Parameters:
        configPropertyName - The config property containing the line to be parsed.
        Returns:
        List of PathMatchers to be used to match filestore volume and path.
      • parseFileSystemConfig

        public static java.util.List<java.nio.file.PathMatcher> parseFileSystemConfig​(java.lang.String config)
        Parse file system include/exclude line.
        Parameters:
        config - The config line to be parsed.
        Returns:
        List of PathMatchers to be used to match filestore volume and path.
      • matches

        public static boolean matches​(java.nio.file.Path text,
                                      java.util.List<java.nio.file.PathMatcher> patterns)
        Checks if text matches any of @param patterns}.
        Parameters:
        text - The text to be matched.
        patterns - List of patterns.
        Returns:
        true if given text matches at least one glob pattern or false otherwise.
        See Also:
        Wikipedia - glob (programming)