Class MCRPathUtils

java.lang.Object
org.mycore.datamodel.niofs.MCRPathUtils

public abstract class MCRPathUtils extends Object
Author:
Thomas Scheffler (yagee)
  • Method Details

    • getAttributes

      public static <A extends BasicFileAttributes> A getAttributes(Path path, Class<A> type, LinkOption... options)
      Returns requested BasicFileAttributes or null if file does not exist. Same as Files.readAttributes(Path, Class, LinkOption...) without throwing IOException.
      Parameters:
      path - the path to the file
      type - the Class of the file attributes required to read
      options - options indicating how symbolic links are handled
      Returns:
      the file attributes
    • getPath

      public static Path getPath(FileSystem targetFS, String fileName)
    • getSize

      public static long getSize(Path p) throws IOException
      Returns the size of the path. If the path is a directory the size returned is the sum of all files found recursivly in this directory.
      Parameters:
      p - path of a file or directory
      Returns:
      the size of p in bytes
      Throws:
      IOException - underlaying IOException