How can I create a zip FileSystem for a zip in a jimfs FileSystem?
njlr opened this issue · 5 comments
njlr commented
I found this, so I think it's supported, but I don't know how to use it.
Attempt 1
FileSystems.newFileSystem(
pathToZipFile.toUri(),
Collections.singletonMap("create", "true"));
java.lang.IllegalArgumentException:
uri (jimfs://814e6cd3-0d35-4c8f-a93d-62f44ffd3825/work/stuff.zip)
may not have a path, query or fragment
Attempt 2
FileSystems.newFileSystem(pathToZipFile, null)
java.nio.file.ProviderNotFoundException: Provider not found
Any ideas?
njlr commented
Ah, I figured out a way:
pathToZipFile.getFileSystem()
.provider()
.newFileSystem(pathToZipFile, new HashMap<>());
njlr commented
Actually, it looks like that method is not meant to be used.
cgdecker commented
Do you have a stack trace for the exceptions you're getting? It should be possible to open a zip file system for a Jimfs file.
bukefalos commented
This worked for me:
FileSystems.newFileSystem(
URI.create("jar:" + pathToZipFile.toUri()),
Collections.singletonMap("create", "true"));
ronshapiro commented
Closing this given that it's stale and lacking some information. If it's still an issue, comment and we can reopen it.