I was wondering if anyone would tell me what I am doing wrong because I'm really stuck and getting really sad :sad:
goal: copy contents of oldZipFile.zip and create a newZip.zip with contents of old zip file.
Problem: If oldZipFile.zip just contains .txt files, it works. But if it contains larger files, such as .doc, then the program crashes- it expected x number of bytes but got x number of bytes instead.
I'm not sure what this error means or how to fix it.
This part of my code is broken down into 3 functions:
1) getZipEntries(String zf) //gets the contents of oldZipFile.zip
File z=new File(zf);
ZipFile zipFile=new ZipFile(z, ZipFile.OPEN_READ);
Enumeration zipFileEntries=zipFile.entries(); //get entries of oldZipFile.zip
zos.putNextEntry(ze); //zos is type ZipOutputStream
3) copy(InputStream in, OutputStream out)
byte buf=new byte;
If anyone can please please help me, I would really appreciate it. Anyone up for the challenge? Thanks.