You cand wrap your ZipOutputStream
around a ByteArrayOutputStream
and get the bytes out of the ByteArrayOutputStream
.
Something like this:
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ZipOutputStream zos = new ZipOutputStream(baos);
//write the entries
zos.close();
byte[] bytes = baos.toByteArray();