Forums Register Login
zipping file
a byte array needs to be zipped and returned, without making use of intermediate temporary file.......i am able to zip as follows:

ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFileName.toString()));
FileInputStream fileStream = new FileInputStream(newFile);
out.putNextEntry(new ZipEntry(zipFileName.toString()));
int len;
while((len = fileStream.read(buf)) > 0) {
out.write(buf, 0, len);

then read the zipped file

in doing so i am first making a zipped file and then reading that file to retrieve the zipped byte array.i dont want this intermediate file to be created and still be able to get the byte array.Any help welcome
Use ByteArrayOutputStream rather than FileOutputStream.

This thread has been viewed 968 times.

All times above are in ranch (not your local) time.
The current ranch time is
Oct 19, 2018 19:44:23.