Is Path object equals to DirectoryEntry object?

Alan Bateman Alan.Bateman at Sun.COM
Mon Aug 4 04:21:40 PDT 2008


Rajendra Gutupalli wrote:
> Hi Alan,
>
> I noticed path.equals(directory entry object) returning true when path 
> and directory entry objects represents same file.
> Please see the following code where c:\\testfolder contains only one 
> file ie. 'onefile'.  Could you please let me know whether the observed 
> behavior satisfies the spec
> where it says "If the given object is not a Path, or is a Path 
> associated with a different provider, then this method immediately 
> returns false.".
Yes, this is okay.  You are locating the directory by Path and the 
result directory entries are also Paths (to satisfy yourself you can 
test that they are indeed instanceof Path).

-Alan.




More information about the nio-dev mailing list