byte[] buf = new byte[1024];//time to make zip file
String zipName="name.zip";
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipName));
for(int i=0; i<copy.length; i++){//put all pdfs in the zip
FileInputStream zipFile = new FileInputStream(copy[i]);
out.putNextEntry(new ZipEntry(copy[i]));
int len;
while((len=zipFile.read(buf))>0){
out.write(buf, 0, len);
}
out.closeEntry();
zipFile.close();
}
out.close();
copy is an array of strings which contain the file path for each file I want (for example C:\files\test.pdf). It compiles and runs fine with no exceptions and creates the zip folder, but nothing is in said zip folder.
fixed it, posting answer if anyone else needs it.
files is an array of files (which I used to create copy).