Package com.swoval.files
Interface DirectoryView
-
- All Superinterfaces:
java.lang.AutoCloseable,FileTreeView
public interface DirectoryView extends FileTreeView
A repository for a directory. TheFileTreeView.list(Path, int, Filter)method will only return non-empty results for paths that are children of the root directory, specified bygetTypedPath().
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetMaxDepth()Returns the maximum depth of children of subdirectories to include below the path specified bygetTypedPath().java.nio.file.PathgetPath()Return the path of the root directory.TypedPathgetTypedPath()Return the typed path of the root directory.java.util.List<TypedPath>list(int maxDepth, Filter<? super TypedPath> filter)List all of the files in the root directory, returning only those files that are accepted by the provided filter.-
Methods inherited from interface com.swoval.files.FileTreeView
list
-
-
-
-
Method Detail
-
getPath
java.nio.file.Path getPath()
Return the path of the root directory.- Returns:
- the path of the root directory.
-
getTypedPath
TypedPath getTypedPath()
Return the typed path of the root directory.- Returns:
- the typed path of the root directory.
-
list
java.util.List<TypedPath> list(int maxDepth, Filter<? super TypedPath> filter) throws java.io.IOException
List all of the files in the root directory, returning only those files that are accepted by the provided filter.- Parameters:
maxDepth- the maximum depth of subdirectories to queryfilter- include only paths accepted by the filter- Returns:
- a List of
Pathinstances accepted by the filter. - Throws:
java.io.IOException- if there is an error listing the directory.
-
getMaxDepth
int getMaxDepth()
Returns the maximum depth of children of subdirectories to include below the path specified bygetTypedPath(). For example, when the value is-1, then the DirectoryView should include only itself. When the value is0, it should include all of the subdirectories and files in the path. When the value is1, it should include all of the subdirectories and files in the path and all of the subdirectories and files in the immediate subdirectories of the path, but not the children of these nested subdirectories. When the value isInteger.MAX_VALUE, all children of the path are included.- Returns:
- the maximum depth of subdirectory children to include.
-
-