public class FileRemoteWalker
extends java.lang.Object
FileTreeWalker
but it does only deal with the FileRemote instances.
The access to the file system can be done in some callback operations.Modifier and Type | Class and Description |
---|---|
static class |
FileRemoteWalker.WalkInfo
Data used for walk.
|
(package private) class |
FileRemoteWalker.WalkThread
Class to build a Thread instance to execute
FileRemote#walkFileTree(int, FileRemoteWalkerCallback) in an extra thread. |
Modifier and Type | Field and Description |
---|---|
(package private) FileRemoteWalkerCallback |
callback |
(package private) FileRemoteCmdEventData |
co |
(package private) EventWithDst<FileRemoteProgressEvData,?> |
evBack |
static java.lang.String |
sVersion
Version, history and license.
|
private FileRemoteWalker.WalkInfo |
walkInfo |
Constructor and Description |
---|
FileRemoteWalker(FileRemoteCmdEventData co,
EventWithDst<FileRemoteProgressEvData,?> evBack) |
Modifier and Type | Method and Description |
---|---|
private SortedTreeWalkerCallback.Result |
postVisitDirectory(FileRemote dir) |
private SortedTreeWalkerCallback.Result |
preVisitDirectory(FileRemote dir)
pre visit a new found directory before enter all children
Note: this is similar
FileAccessorLocalJava7.WalkFileTreeVisitor#preVisitDirectory(Path, java.nio.file.attribute.BasicFileAttributes)
but improved. |
private SortedTreeWalkerCallback.Result |
visitFile(FileRemote file) |
protected void |
walkFileTree() |
static void |
walkFileTree(FileRemoteCmdEventData co,
EventWithDst<FileRemoteProgressEvData,?> evBack)
Walks to the tree of children with given files, without synchronization with the device.
|
static void |
walkFileTreeThread(FileRemoteCmdEventData co,
EventWithDst<FileRemoteProgressEvData,?> evBack)
Walks to the tree of children with given files, without synchronization with the device.
|
private SortedTreeWalkerCallback.Result |
walkSubTree(FileRemote dir,
int depth)
See
#walkFileTree(int, FileRemoteWalkerCallback) , invoked internally recursively. |
public static final java.lang.String sVersion
Files
was present.
private FileRemoteWalker.WalkInfo walkInfo
final FileRemoteCmdEventData co
final FileRemoteWalkerCallback callback
final EventWithDst<FileRemoteProgressEvData,?> evBack
public FileRemoteWalker(FileRemoteCmdEventData co, EventWithDst<FileRemoteProgressEvData,?> evBack)
public static void walkFileTree(FileRemoteCmdEventData co, EventWithDst<FileRemoteProgressEvData,?> evBack)
#walkFileTreeThread(int, FileRemoteWalkerCallback)
.
This operation is not intent to use working with the real file system.
For example #copyDirTreeTo(FileRemote, int, String, int, FileRemoteProgressEvData)
calls internally FileRemoteAccessor#walkFileTree(FileRemote, boolean, boolean, boolean, String, long, int, FileRemoteWalkerCallback)
which is implemented in the device, for example using java.nio.file.Files operations.
This operation iterates only over the children and sub children in the FileRemote directory tree.
Whether the FileRemote instances are synchronized with the file device or not, should be clarified in the callback.
Note: it should not change the children list, because it uses an iterator.depth
- at least 1 for enter in the first directory. Use 0 if all levels should enter.callback
- contains the quest and operations due to the files.public static void walkFileTreeThread(FileRemoteCmdEventData co, EventWithDst<FileRemoteProgressEvData,?> evBack)
FileRemoteWalker.WalkThread
and runs #walkFileTree(int, FileRemoteWalkerCallback)
in that thread.
The user is informed about progress and results via the callback instance.
Note: The file tree should not be changed outside or inside the callback methods because the walk method uses an iterators.
If the children lists are changed concurrently, then the walking procedure may be aborted because an ConcurrentModificationException
is thrown.depth
- at least 1. Use 0 to enter all levels.callback
- protected void walkFileTree()
private SortedTreeWalkerCallback.Result walkSubTree(FileRemote dir, int depth)
#walkFileTree(int, FileRemoteWalkerCallback)
, invoked internally recursively.private SortedTreeWalkerCallback.Result preVisitDirectory(FileRemote dir)
FileAccessorLocalJava7.WalkFileTreeVisitor#preVisitDirectory(Path, java.nio.file.attribute.BasicFileAttributes)
but improved. TODO improve also in AccessorwalkInfo
- co
- private SortedTreeWalkerCallback.Result postVisitDirectory(FileRemote dir)
private SortedTreeWalkerCallback.Result visitFile(FileRemote file)