How to .resolve*() and .relativize() Paths which are not issued from the same FileSystem?
Francis Galiegue
fgaliegue at gmail.com
Tue Dec 2 13:25:36 UTC 2014
On Tue, Dec 2, 2014 at 11:50 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 01/12/2014 19:13, Francis Galiegue wrote:
>>
>> As I said: an empty path _for which filesystem_? The one associated
>> with the path you try to .resolveSibling() against or the one of the
>> path given as an argument? This is what the documentation is not clear
>> about (without even going to the provider level).
>>
> I see your point and answering this comes back to how a custom provider is
> suppose to behave when it has distinct FileSystem implementations. I need to
> think about this issue a bit more as changing anything here risks creating
> inconsistencies between resolve/resolveSibling/relativize so great care is
> required. Hopefully get back to you in a few days when I find time.
>
> -Alan.
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!
Regards,
--
Francis Galiegue, fgaliegue at gmail.com, https://github.com/fge
JSON Schema in Java: http://json-schema-validator.herokuapp.com
Parsers in pure Java: https://github.com/parboiled1/grappa (redde
Caesaris: https://github.com/sirthias)
More information about the nio-dev
mailing list