anonymous tech woman

Yet another woman in technology blog. I'm actually a developer who uses a variety of Java and database technologies on a variety of platforms.

Thursday, August 03, 2006

I've been using the package to unzip and zip up openoffice files. The package is actually for reading and writing standard zip files but I thought I would try it out with openoffice write and openoffice calc files. I therefore have had to use the classes ZipEntry, ZipFile, ZipInputStream and ZipOutputStream to compress and decompress my files. There is one major problem with these classes- that is that the ZipOutputStream class has no way of compressing the empty folders needed in the openoffice open document file formats.

This means that you have to create a file by path name and use a separate to create an empty folder:

ZipEntry zipEntry = new ZipEntry(oldFile.getPath() + System.getProperty("file.separator") + " ");

This actually creates
an empty file in the zip archive with the folder name which when you open the entire document openoffice restores the file to a folder for you.

Technorati Tags: Openoffice,, zip files


Post a Comment

<< Home