Catch any exceptions in close.
Catch any exceptions in close.
Returns the FileTreeDataViews.Entry associated with the path specified by CachedDirectory.getPath.
Returns the FileTreeDataViews.Entry associated with the path specified by CachedDirectory.getPath.
the entry
Returns the maximum depth of children of subdirectories to include below the path specified by DirectoryView.getTypedPath.
Returns the maximum depth of children of subdirectories to include below the path specified by
DirectoryView.getTypedPath. For example, when the value is -1
, then the
DirectoryView should include only itself. When the value is 0
, it should include
all of the subdirectories and files in the path. When the value is 1
, 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 is Integer.MAX_VALUE
, all children of the path are
included.
the maximum depth of subdirectory children to include.
Return the path of the root directory.
Return the path of the root directory.
the path of the root directory.
Return the typed path of the root directory.
Return the typed path of the root directory.
the typed path of the root directory.
List all of the files for the path
, returning only those files that are accepted by the
provided filter.
List all of the files for the path
, returning only those files that are accepted by the
provided filter. Unlike FileTreeView, this implementation cannot throw an IOException
because list should be using the cache and not performing IO.
the root path to list
the maximum depth of subdirectories to query
include only paths accepted by the filter
a List of java.nio.file.Path instances accepted by the filter.
List all of the files in the root directory, returning only those files that are accepted by the provided filter.
List all of the files in the root directory, returning only those files that are accepted by the provided filter. Unlike FileTreeView, this implementation cannot throw an IOException because list should be using the cache and not performing IO.
the maximum depth of subdirectories to query
include only paths accepted by the filter
a List of java.nio.file.Path instances accepted by the filter.
List the children of the path specified by CachedDirectory.getPath, excluding the entry for the path itself.
List the children of the path specified by CachedDirectory.getPath, excluding the
entry for the path itself. When the maxDepth parameter is
-1
, return just the entry for the path itself.
the maximum depth of children (see DirectoryView.getMaxDepth)
only include entries matching this filter
a list containing all of the entries included by the filter up to the max depth.
List all of the files for the path
that are accepted by the filter
.
List all of the files for the path
that are accepted by the filter
.
the path to list. If this is a file, returns a list containing the Entry for the file or an empty list if the file is not monitored by the path.
the maximum depth of subdirectories to return
include only paths accepted by this
a List of Entry instances accepted by the filter. The list will be empty if the path is not a subdirectory of this CachedDirectory or if it is a subdirectory, but the CachedDirectory was created without the recursive flag.
Remove a path from the directory.
Remove a path from the directory.
the path to remove
a List containing the Entry instances for the removed path. The result also contains the cache entries for any children of the path when the path is a non-empty directory.
Updates the CachedDirectory entry for a particular typed typedPath.
Updates the CachedDirectory entry for a particular typed typedPath.
the typedPath to update
if true, rescan the entire subtree for this directory. This can be very expensive.
a list of updates for the typedPath. When the typedPath is new, the updates have the oldCachedPath field set to null and will contain all of the children of the new typedPath when it is a directory. For an existing typedPath, the List contains a single Updates that contains the previous and new Entry. traversing the directory.
Updates the CachedDirectory entry for a particular typed typedPath.
Updates the CachedDirectory entry for a particular typed typedPath.
the typedPath to update
a list of updates for the typedPath. When the typedPath is new, the updates have the oldCachedPath field set to null and will contain all of the children of the new typedPath when it is a directory. For an existing typedPath, the List contains a single Updates that contains the previous and new Entry. traversing the directory.
Provides a mutable in-memory cache of files and subdirectories with basic CRUD functionality. The CachedDirectory can be fully recursive as the subdirectories are themselves stored as recursive (when the CachedDirectory is initialized without the recursive toggle, the subdirectories are stored as Entry instances. The primary use case is the implementation of FileTreeRepository and NioPathWatcher. Directly handling CachedDirectory instances is discouraged because it is inherently mutable so it's better to let the FileTreeRepository manage it and query the cache rather than CachedDirectory directly.
The CachedDirectory should cache all of the files and subdirectories up the maximum depth. A maximum depth of zero means that the CachedDirectory should cache the subdirectories, but not traverse them. A depth
< 0
means that it should not cache any files or subdirectories within the directory. In the event that a loop is created by symlinks, the CachedDirectory will include the symlink that completes the loop, but will not descend further (inducing a loop).the cache value type.