Review All Gadget, Samsung Galaxy Note, Firmware/ Flash File, Auto Forward, Transfer from Note 7 to Computer/Mac, Transfer Data Contacts from HTC to Samsung, Chimera Tool Samsung

Jumat, 11 April 2008

Java - Create Zip file in memory

Java - Create Zip file in memory - do you know that every day there are new gadgets that are created, every gadget has its own way to use it, in blogs Review All Gadget we are reviewing gadgets from various brands ranging from spec, price and how to use the feature, now we are discussing iformasi that you are looking for Java - Create Zip file in memory this information we collect from many reliable sources so that complete for you. please see.

Articles : Java - Create Zip file in memory
full Link : Java - Create Zip file in memory

You can also see our article on:


Java - Create Zip file in memory

I find myself writing and rewriting this piece of code whenever I want to zip a set of files (in memory) and return the zipped file back as an object in memory. I often use this when the user requests a download of multiple reports and the deployment environment doesn't allow for disk access.

I thought I'd post it here so that I could copy-paste it the next time I need it :) If you've stumbled upon this page, you're free to use the code below too!



private static byte[] createZip(Map files) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ZipOutputStream zipfile = new ZipOutputStream(bos);
Iterator i = files.keySet().iterator();
String fileName = null;
ZipEntry zipentry = null;
while (i.hasNext()) {
fileName = (String) i.next();
zipentry = new ZipEntry(fileName);
zipfile.putNextEntry(zipentry);
zipfile.write((byte[]) files.get(fileName));
}
zipfile.close();
return bos.toByteArray();
}



information Java - Create Zip file in memory has been discussed

hopefully the information we provide with title Java - Create Zip file in memory can provide more benefits for you.

well this information Java - Create Zip file in memory we have finished, if you intend to bookmark or sharenya can use link http://almourasiloun2.blogspot.com/2008/04/java-create-zip-file-in-memory.html.

Tag :
Share on Facebook
Share on Twitter
Share on Google+
Tags :

Related : Java - Create Zip file in memory

0 komentar:

Posting Komentar