News Latest Technology, How to Fix Apple iPhone, contrast and brightness, Wireless Headphone, android KitKat stock firmware, XiaoMi Mi Pad, Tracfone Promo

Jumat, 11 April 2008

Java - Create Zip file in memory

Java - Create Zip file in memory - with more and more gadgets of new products, we should be literate technology because the product is made with the purpose to further facilitate our lives, on the blog News Latest Technology we will discuss about new and old products, we will explain the full pungsi, well now we will first clean up about Java - Create Zip file in memory we have collected a lot of data to make this article so you do not deleted information. 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();
}



quite so many infromation Java - Create Zip file in memory

hopefully the information we provide about Java - Create Zip file in memory we provide can be useful for your life especially in determining the gadget according to your requirement.

just smell you finished reading the article about Java - Create Zip file in memory if intend to share or just bookmark please use link https://memesmemosos.blogspot.com/2008/04/java-create-zip-file-in-memory.html to get more information about gadget please visit other pages on this blog that we guarantee super complete.

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

Related : Java - Create Zip file in memory

0 komentar:

Posting Komentar