commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <>
Subject Re: [vfs] newbie - extract zip files
Date Mon, 04 Sep 2006 10:57:47 GMT
Hi Monica!
> I need to extract the files contained in a zip after a web upload.
If you have a InputStream only you can feed this stream to the tmp:
filesystem with something like this:

        FileObject foZip =
        OutputStream os = foZip.getContent().getOutputStream();
        byte[] buf = new byte[4096];
        int read;
        while ((read = > -1)
            os.write(buf, 0, read);
        FileObject foZipContent =

But for sure, this requires at least a writable temporary filespace (by
default the os tmpdir as you can find in java system environment
If it is really absolutely not possible to write to the local disk you
can replace the "tmp:/" in the above example (two times) with "ram:/",
though, that requires you to have enough memory available to hold the
zipped data.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message