This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Servlets and the fly likes outputting zip file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "outputting zip file " Watch "outputting zip file " New topic
Author

outputting zip file

ravindra patil
Ranch Hand

Joined: Sep 01, 2006
Posts: 234
Hi ....
i am new to file IO ... and
i want to output zip file containg one or more xml files in zip through servet

i am creating multiple JDOM Document objects and i need to put all files into ZIP ..

ServletOutputStream outX = res.getOutputStream();

// outX.write(); this method takes bytes as input i dont know how should i input my JDOM object to this method

anyidea ??

thanks
Ravi
olivier dutranoit
Ranch Hand

Joined: Aug 20, 2011
Posts: 81

for creating zips, try using

import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: outputting zip file
 
It's not a secret anymore!