Results 1 to 2 of 2
- 06-11-2010, 02:34 PM #1
Member
- Join Date
- Jun 2010
- Posts
- 1
- Rep Power
- 0
How do I store images in a zip file in Java
Hi,
I am trying to write some code to collect a load of images from URLs and then to store them in a zip file. So I have written code to get each image into an Image object thus:-
// create the zip file/stream
FileOutputStream dest = new FileOutputStream("d://images.zip");
out = new ZipOutputStream(new BufferedOutputStream(dest));
while ( (record=dis.readLine()) != null ) { // This is reading a text file containing the list of images
String URLStr = UrlStem + record;
URL url = new URL(URLStr);
URLConnection urlconnection = url.openConnection();
image = ImageIO.read(url);
// Now want to add this image to a zip file - but how??
...
}
but I can't see how to then how to add it to a zip file. The images might be GIFs or JPEGS. I have seen examples of adding files from a directory but not of doing it on the fly - is it possible?
Thanks in advance
- 06-11-2010, 03:53 PM #2
Senior Member
- Join Date
- Feb 2009
- Posts
- 303
- Rep Power
- 5
Similar Threads
-
store data into an array from a file
By chopo1980 in forum New To JavaReplies: 10Last Post: 11-13-2009, 09:48 AM -
how to store string in text file
By santhosh_el in forum AWT / SwingReplies: 2Last Post: 04-03-2009, 06:21 AM -
How would you get information from a file and then store it in an array?
By szimme101 in forum Advanced JavaReplies: 3Last Post: 04-07-2008, 06:02 PM -
How to store property file into key value pair
By Java Tip in forum java.utilReplies: 0Last Post: 04-05-2008, 10:16 AM -
store file
By kazitula in forum Java AppletsReplies: 0Last Post: 02-17-2008, 09:45 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks