• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FileVisitResult

 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Tony Docherty
Bartender
Posts: 2939
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried writing some code to see what the difference is?
 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Directory Structure(D:\OCJP7\IO\FileIO(WithNIO2)\FileVisitor\root)
[Thumbnail for untitled.JPG]
 
Tony Docherty
Bartender
Posts: 2939
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So has that answered your question?
 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2939
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There probably are several ways to get the same effect by returning combinations of values from different methods, the FileVisitor is very versatile.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic