Samsung Galaxy Note, 4G LTE Plans, Transfer Photos Videos from iPhone to Samsung, Network Performance, Mobile Accounts, Furious Gold SPD TooL, Latest Version Full Setup

Info Java - Create Zip file in memory

Info Java - Create Zip file in memory - this blog we have built from a few years ago and already very much information about gadgets that we convey and a lot of blog visitors New Blog Techno News who are satisfied with the information, we will always try to update the latest information for you, first about Info Java - Create Zip file in memory many already we collect data to make this article so you do not miss the news, please see:

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

You can also see our article on:


Info 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();
}



articles Info Java - Create Zip file in memory finished in discussion

hopefully the information we convey about Info Java - Create Zip file in memory can benefit you in getting new knowledge about technology,

you just finished reading the information Info Java - Create Zip file in memory we hope this informmation can answer the question you submit to googlle, if you want to bookmark or share please use link https://moymoycikukecik.blogspot.com/2008/04/info-java-create-zip-file-in-memory.html and do not forget to always visit this blog to get the latest information every day.

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

Related : Info Java - Create Zip file in memory

0 komentar:

Posting Komentar