I have code for create zip file in servlet like this :
ByteArrayOutputStream baos =null;
baos = new ByteArrayOutputStream();
ZipOutputStream zos = new ZipOutputStream(baos);
for(list of file){
bis = new BufferedInputStream(new FileInputStream(("somefile.extn"));
other code for add entry in zip file
bis.close();
}
baos.flush();
zos.flush();
zos.close();
baos.close();
// Return bytes
baos.toByteArray();
// Write bytes to ServletOutputStream
Is there any problem if I flush & close ByteArrayOutputStream
object (baos
).
Thanks for looking here :)