posted 21 years ago
I would like to append a file to an existing zip file using ZipOutputStream. Please provide some sample code to do that. I used the following code.
BufferedInputStream fileNameToBeAppended= new BufferedInputStream(
new FileInputStream(tempFileName), BUFFER);
ZipOutputStream zipOS = new ZipOutputStream(
new FileOutputStream(TotalZip.zip",true));
zipFile = new ZipEntry(tempFileName);
zipOS.putNextEntry(zipFile);
int count;
while ((count = bis.read(data, 0, BUFFER)) != -1) {
zipOS.write(data, 0, count);
}
bis.close();
The above code is overriding the existing zip file with the new file instead of appending.
Thanks,
Srini
Srini<br />scea,scdjws,scbcd, scwcd,scjp