Good clue, but I tried that already.  Still doesn't work.

Thanks for the hint, though!

Cheers!
Mark

I am a deeply superficial person.  -Andy Warhol

This email was scanned with Norton AntiVirus 2002 before sending.

----- Original Message -----
From: "Brad Thomas" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 04, 2001 8:42 PM
Subject: Re: Zip problem: banging head against wall!


Mark
I'm not a java guru AT ALL, but it appears to me that
FileOutputStream fos = new FileOutputStream( zip);
keeps recreating the zip file for each file you want
to put in it.... because in your while loop,
(at the end of the loop) you're doing a fos.close ???

Try putting the
FileOutputStream fos = new FileOutputStream( zip);
and the
fos.close()
outside of the while loop ??

Brad


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 5/10/01, 10:24:32, Mark Galbreath <[EMAIL PROTECTED]> wrote regarding
Re: Zip problem: banging head against wall!:


> Can ANYBODY explain why the enumerated files are overwriting the
previously
> zipped file in the .zip file so that only the last file shows up in the
> .zip?

> Thanks,
> Mark

> public static void addFilesToZip( Vector files) {
>     Enumeration enum = files.elements();

>     try {
>         while( enum.hasMoreElements()) {
>             File file = (File) enum.nextElement();
>             String zip = zipFile.getCanonicalPath().toString();
>             FileOutputStream fos = new FileOutputStream( zip);
>             CheckedOutputStream csum = new CheckedOutputStream( fos, new
> Adler32());
>             ZipOutputStream zos = new ZipOutputStream( new
> BufferedOutputStream( csum));
>             System.out.println( "\nCompressing and adding file " + file +
"
> to " + zip + "....");
>             BufferedReader br = new BufferedReader( new FileReader(
file));
>             zos.putNextEntry( new ZipEntry(
> file.getAbsolutePath().toString()));

>             System.out.println( "Buffer size = " + br.read() + " bytes");
>             while( br.read() != -1) {
>                 zos.write( br.read());
>             }

>             br.close();
>             zos.close();
>             System.out.println( "File checksum: " +
> csum.getChecksum().getValue());
>             //System.out.println( "Deleting file: " + file);
>             //file.delete();
>         }
>     } catch( NoSuchElementException e) {
>         e.printStackTrace();
>     } catch( FileNotFoundException e) {
>         e.printStackTrace();
>     } catch( ZipException e) {
>         e.printStackTrace();
>     } catch( IOException e) {
>         e.printStackTrace();
>     }
> }



> I am a deeply superficial person.  -Andy Warhol

> This email was scanned with Norton AntiVirus 2002 before sending.

>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".

> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to