Techno News Latest, Whatsapp, Samsung, How To Flash, MediaTek device, Sony Flash Tool Original, Free Browsing, Transfer Contacts, Moto Shop, Walton Primo, price and specification

Java - Create Zip file in memory

Java - Create Zip file in memory - we should be concerned about the technology that continues to grow, because the technology is created to facilitate our lives, with technology we can do any job faster so save time and money, ok on the blog Techno News Latest we will discuss a variety of new technologies that continue to grow, now we will membahs first about Java - Create Zip file in memory please see to finish:

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 have provided with the title Java - Create Zip file in memory can provide more knowledge for you in determining the choice of gadget that suits your needs.

you just finished reading the article Java - Create Zip file in memory if you think this information is worth to book mark or share please use link https://puriagatsari.blogspot.com/2008/04/java-create-zip-file-in-memory.html to get more information about gadget please visit other pages on this blog, thank you.

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

Related : Java - Create Zip file in memory

0 komentar:

Posting Komentar