Fw: Patch for File Scanning
mike.skells at talk21.com
Thu Oct 27 16:21:35 PDT 2011
I that that the benefit in cpu would be more the store the file name than the parent directory [I was just storing it because it was available].
I would be surprised if most implementations would not inspect the name of the file in some way as there is not a lot that you could do [open the file, print the full path and count the paths]
and the cost just a String reference [the local file name] or an offset in the current string. Not including the parent also avoids a single path retaining the memory for a chain of parent paths
Either way it is your call and I defer to your judgement :-)
BTW I always found it strange that the file name could not be read as a string directly as opposed to Path.getFileName().toString()
>From: Alan Bateman <Alan.Bateman at oracle.com>
>The parent directory is already reported to the preVisitDirectory method so it really depends on the FileVisitor implementation to know if this will help. More generally I think there's a project here to choose the right (internal) representation and come up with the right balance (meaning space/performance tradeoff) for these path access methods. If it's okay with you I think we should separate that from the jar tool/file tree walking work.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the nio-dev