hey hey,

yes i know, "him again" :p

well i got the following question.
i want to create a zipped file but when i create it and i go into the zipped file and want to read the files in it it gave me an error files not found.

i don't know what i'm doing wrong or what i'm missing but u tried different things but ended up with more errors.

this is the code i have so far...

Java Code:
package ZipTheFiles;

import java.io.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import java.util.*;

public class TheReturnOfTheZip {

	public static void main(String[] args){
		   String[] filenames = new String[]{"c:\\CrapMap\\KlantenBestand.txt.txt", "c:\\CrapMap\\KlantenBestand2.txt.txt"};
		   byte[] buf = new byte[1024];
		    BufferedInputStream bif;
		    try {
		        String outFilename = "c:\\CrapMap\\ZipIsHip.zip";
		        ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(outFilename)));
		        FileInputStream in;
		        	for (int i=0; i<filenames.length; i++) {
		        		in = new FileInputStream(filenames[i]);
		        		bif = new BufferedInputStream(in);
		        		ZipEntry zipEntry = new ZipEntry(filenames[i]);
		        		out.putNextEntry(zipEntry);
				        int len,pos=0;
				        while ((len = bif.read(buf,0,1024)) != -1) {
				           out.write(buf, 0, len);
				           pos+=len;
				        }
		           out.closeEntry();
		           bif.close();
		           System.out.println("succes");
		        }
		        out.finish();
		        out.close();
		    }
		    
		    catch (IOException e) {
		    }
		  }
		}
i hope you will help me solve this problem.

ps: this is someting i dont get at school, i figured this out by myself.
at school we need to use the DeflaterOutputStream, but i wanted to try this since this looks better then the DeflaterOutputStream.

thx in advance,

all the best,

Dieter