1Z0-805J Free Dumps Study Materials
Question 8: どの 2 つのステ ートメントはフゔルクラスの walkFileTree 方法について真ですか。
A. 与えられた FileVisitor が発生し たフゔ ルごとに 呼び出 され て フゔル ツリー トラバ ー
サルは幅優先です。
B. フゔルがデゖレ クトリである場合、 そのデゖレクトリは開くことができなかった場合、
postVisitFileFailed 方法 は I/O 異常で呼び出されます。
C. MAXDEPTH パラメー ターの値は訪問する デゖレクトリの最大数です。
D. デフォルトでは、 シンボリックリンクが自動的に方法が続いていません。
Correct Answer: C,D
Explanation:
C: The method walkFileTree(Path start, Set<FileVisitOption> options, int maxDepth, FileVisitor<?
super Path> visitor) walks a file tree. The maxDepth parameter is the maximum number of levels of
directories to visit. A value of 0 means that only the starting file is visited, unless denied by the
security manager. A value of MAX_VALUE may be used to indicate that all levels should be visited.
The visitFile method is invoked for all files, including directories, encountered at maxDepth, unless
the basic file attributes cannot be read, in which case the visitFileFailed method is invoked.
D: You need to decide whether you want symbolic links to be followed. If you are deleting files, for
example, following symbolic links might not be advisable. If you are copying a file tree, you might
want to allow it. By default, walkFileTree does not follow symbolic links.
Reference: The Java Tutorials, Walking the File Tree
Reference: walkFileTree