How to .resolve*() and .relativize() Paths which are not issued from the same FileSystem?

Alan Bateman Alan.Bateman at oracle.com
Wed Dec 3 14:53:06 UTC 2014


On 02/12/2014 13:25, Francis Galiegue wrote:
> :
> Well, I have done a lot of procrastination on the subject for some
> time already (I have a somewhat working FileSystem implementation over
> FTP already, and now I'm trying to generalize it) and I have come up
> with some ideas already.
>
> For instance, Paths.resolve(source, other): would work like Path's
> .resolve(), except that it is guaranteed that the resulting path will
> be associated to the FileSystem of "source"; of course, it requires
> that generated Paths for a same provider are consistent between
> FileSystem instances -- as far as I can see, this is not even a
> requirement, right?
>
> I will get to it in code; I intend to write a library to work around
> the "user side" of java.nio.file in the same way that at this moment I
> write a "developer side" library to implement custom filesystems...
>
> But all in all, I am quite interested in such a discussion!
>
>
One potential solution is that resolve(other) should be specified to 
always return "other" then "other" is associated with a different 
FileSystem to that of "this". I need to look through the implications of 
this to ensure that everything would remain consistent. It would mean 
that resolve would not need to throw ProviderMismatchException too. As I 
said, give me a few days to find time to think about this.

-Alan


More information about the nio-dev mailing list