java.lang.Object | |
↳ | com.facebook.common.file.FileTree |
Utility class to visit a file tree. There's similar functionality in Java 7's Files.walkFileTree method. Its methods could be merge into FileUtil (although it seems to have a lot of crazy redundant methods, maybe for testing, but crazy anyway).
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
FileTree() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static boolean |
deleteContents(File directory)
Deletes all files and subdirectories in directory (doesn't delete the directory passed as
parameter).
| ||||||||||
static boolean |
deleteRecursively(File file)
Deletes the file and if it's a directory deletes also any content in it
| ||||||||||
static void |
walkFileTree(File directory, FileTreeVisitor visitor)
Iterates over the file tree of a directory.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Deletes all files and subdirectories in directory (doesn't delete the directory passed as parameter).
Deletes the file and if it's a directory deletes also any content in it
file | a file or directory |
---|
Iterates over the file tree of a directory. It receives a visitor and will call its methods for each file in the directory. preVisitDirectory (directory) visitFile (file) - recursively the same for every subdirectory postVisitDirectory (directory)
directory | the directory to iterate |
---|---|
visitor | the visitor that will be invoked for each directory/file in the tree |