Bundled zip FileSystemProvider fails to recognize "readonly"?
Francis Galiegue
fgaliegue at gmail.com
Tue Apr 21 16:26:24 UTC 2015
On Tue, Apr 21, 2015 at 6:12 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 17/04/2015 16:24, Francis Galiegue wrote:
>>
>> :
>> OK... But I believe it would be a nice option to have. Would such a
>> feature request be considered at all?
>>
> No objection but I wonder if it is would be used. Are you looking for this
> specifically for the zip provider or thinking about an equivalent with
> another provider?
>
That is a good question... And which I believe is somewhat related to
the usage of JSR 203 today. And that is still, unfortunately, very
little.
And I am certainly not a "guinea pig" for a casual user since I
implemented a couple of FileSystems myself. Anyway, in this package
(https://github.com/fge/java7-fs-more), I have implemented a
MoreFileSystems.openZip(path, boolean), which, if the second argument
is true ("read only, please"), wraps the JRE provided
FileSystemProvider and FileSystem with "read only" versions (that is,
throw ReadOnlyFileSystemException on any write attempt).
Notwithstanding the "shortcuts" made available (that is: open a
FileSystem over the zip; then wrap it read only if requested), I
believe it would be a nice addition to the standard API to provide a
way to do this, as in:
FileSystems.newReadOnlyFileSystem(uri, env)
or the like.
--
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/fge/grappa
More information about the nio-dev
mailing list