Package org.mycore.datamodel.niofs
Class MCRPathUtils
java.lang.Object
org.mycore.datamodel.niofs.MCRPathUtils
- Author:
- Thomas Scheffler (yagee)
-
Method Summary
Modifier and TypeMethodDescriptionstatic <A extends BasicFileAttributes>
AgetAttributes
(Path path, Class<A> type, LinkOption... options) Returns requestedBasicFileAttributes
or null if file does not exist.static Path
getPath
(FileSystem targetFS, String fileName) static long
Returns the size of the path.
-
Method Details
-
getAttributes
public static <A extends BasicFileAttributes> A getAttributes(Path path, Class<A> type, LinkOption... options) Returns requestedBasicFileAttributes
or null if file does not exist. Same asFiles.readAttributes(Path, Class, LinkOption...)
without throwingIOException
.- Parameters:
path
- the path to the filetype
- theClass
of the file attributes required to readoptions
- options indicating how symbolic links are handled- Returns:
- the file attributes
-
getPath
-
getSize
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
-