Zip file system provider only works with default file system

Michael Hall mik3hall at
Sat Dec 8 12:18:15 PST 2012

It's a demo.

Couldn't you just temporarily put your own ZipFileSystem in classpath some place before the default version jar?

With something like…

In com.sun.nio.zipfs.ZipFileSystem

    // Creates a new empty temporary file in the same directory as the
    // specified file.  A variant of File.createTempFile.
    private Path createTempFileInSameDirectoryAs(Path path)
        throws IOException
        Path parent = path.toAbsolutePath().getParent();
        Path tmpPath = Files.createTempFile(dir,"zipfstmp", null);
        return tmpPath;

Assumes it'll use the correct FileSystem as the parameter's Path all the way through, I haven't tested it at all.
Not sure if there are any complications with a com.sun class. You could change the demo package.
Are you just trying this out or do you intend to use the demo code in something production?

Michael Hall

trz nio.2 for OS X

HalfPipe Java 6/7 shell app

AppConverter convert Apple jvm to openjdk apps

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the nio-dev mailing list