Class Paths

java.lang.Object
com.pervasive.datarush.io.Paths

public class Paths extends Object
A factory for creating Path objects. Paths are commonly represented as strings. This class provides methods for obtaining the Path identified by such as string.
  • Method Details

    • asPath

      public static Path asPath(String path)
      Parses a string representing a path into a Path object.
      Parameters:
      path - a string representation of a path
      Returns:
      the path identified by the string
      Throws:
      IllegalArgumentException - if the provided string does not represent a supported path syntax
      DRException - if no configured provider could be found for the scheme
    • asPaths

      public static List<Path> asPaths(List<String> paths)
      Parses a string list representing a path into a list of Path's.
      Parameters:
      paths - a list of string paths
      Returns:
      the paths identified by the strings
      Throws:
      IllegalArgumentException - if the provided strings do not represent a supported path syntax
      DRException - if no configured provider could be found for the scheme
    • asPath

      public static Path asPath(File file)
      Converts a File into a Path object. This method provides a bridge between the java.io package and DataRush.
      Parameters:
      file - the file located by the path
      Returns:
      the path identified by the file
    • asPaths

      public static Path[] asPaths(File[] files)
      Converts an array of files into an array of paths.
      Parameters:
      files - the array of files
      Returns:
      an array of paths
    • getIndexFile

      public static File getIndexFile(Path path)
      Returns the index file associated with a temporary file path.
      Parameters:
      path - a temporary path
      Returns:
      the index file
      Throws:
      ClassCastException - if the provided path is not a temporary path
    • getProvider

      public static FileSystemProvider getProvider(String path)
      Locates the provider identified by the scheme of the specified path string.
      Parameters:
      path - the string representation of a path for which to find the configured provider. Only a schema prefix is required; additional scheme-specific information is ignored.
      Returns:
      the provider for the path scheme
      Throws:
      DRException - if no configured provider could be found for the scheme
    • getDefaultConfiguration

      public static Map<String,FileConfiguration> getDefaultConfiguration()
      Collects the default configuration for all installed providers.

      This method does not generally need to be called by end users. FileMetaConfiguration objects will automatically add default configuration when created.

      Returns:
      a mapping of scheme to default configuration covering all installed providers
      See Also:
    • extractPaths

      public static List<Path> extractPaths(List<PathDetails> details)
      Convert a list of PathDetails objects to a list of Path objects. Will not include hidden objects.
      Parameters:
      details - a list of file system object metadata
      Returns:
      a list of paths references in the metadata
    • extractPaths

      public static List<Path> extractPaths(List<PathDetails> details, boolean includeHidden)
      Convert a list of PathDetails objects to a list of Path objects.
      Parameters:
      details - a list of file system object metadata
      includeHidden - whether hidden files should be included in the list
      Returns:
      a list of paths references in the metadata