Return a Stream
that is lazily populated with
Path
by walking the file tree rooted at a given starting file. The
file tree is traversed depth-first, the elements in the stream
are Path
objects that are obtained as if by resolving
the relative path against start
.
This method works as if invoking it were equivalent to evaluating the expression:
In other words, it visits all levels of the file tree.walk(start, Integer.MAX_VALUE, options)
The returned stream encapsulates one or more DirectoryStream
s.
If timely disposal of file system resources is required, the
try
-with-resources construct should be used to ensure that the
stream's close
method is invoked after the stream
operations are completed. Operating on a closed stream will result in an
java.lang.IllegalStateException
.
start
| the starting file | |
options
| options to configure the traversal |
SecurityException
| If the security manager denies access to the starting file.
In the case of the default provider, the checkRead method is invoked
to check read access to the directory. | |
IOException
| if an I/O error is thrown when accessing the starting file. |
walk(Path, int, FileVisitOption...)
Diagram: Files