wood burning stoves 2.0*
The moose likes I/O and Streams and the fly likes FileVisitResult Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "FileVisitResult" Watch "FileVisitResult" New topic
Author

FileVisitResult

meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305


java.nio.file
Enum FileVisitResult

SKIP_SIBLINGS
Continue without visiting the siblings of this file or directory.
SKIP_SUBTREE
Continue without visiting the entries in this directory.


I do understand SKIP_SUBTREE, but how SKIP_SIBLINGS is different from that ?

Thanks


My one regret in life is that I am not someone else.
- Woody Allen
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2172
    
  47
Have you tried writing some code to see what the difference is?
meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305

Tony Docherty wrote:Have you tried writing some code to see what the difference is?


I tried this.


Initiating root
Initiating dir1
D:\OCJP7\IO\FileIO(WithNIO2)\FileVisitor\root\dir1\dir1file.txt
End of dir1
Initiating dir2
End of root


Initiating root
Initiating dir1
D:\OCJP7\IO\FileIO(WithNIO2)\FileVisitor\root\dir1\dir1file.txt
End of dir1
Initiating dir2
D:\OCJP7\IO\FileIO(WithNIO2)\FileVisitor\root\rootfile.txt
End of root



[untitled.JPG]

Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2172
    
  47
So has that answered your question?
meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305

Tony Docherty wrote:So has that answered your question?
Getting something but not whole.I can get same effect with SKIP_SIBLINGS=(pre)SKIP_SUBTREE+(post)TERMINATE
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2172
    
  47
There probably are several ways to get the same effect by returning combinations of values from different methods, the FileVisitor is very versatile.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: FileVisitResult
 
Similar Threads
is there a way to print a custom header/footer in eclipse?
which is faster in List Classes
Need Help with binding click events to table rows
warned?
Is there a JavaRanch equal in the C++ community?