Hi
I need some help on ZLib archive file. The code is as follows,
// get all the files from the drive
File f = new File("C:\\DA_SRC\\DA_Temp\\C");
String fileList[] = f.list();
File zipFile = new File(f.getAbsolutePath() + "\\Test.zip");
System.out.println(f.getAbsolutePath() + f.getCanonicalPath());
FileOutputStream fos = new FileOutputStream(zipFile);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Deflater def = new Deflater(Deflater.DEFAULT_COMPRESSION);
DeflaterOutputStream out = new DeflaterOutputStream(baos,def);
int bytesRead;
byte[] buffer = new byte[1024];
BufferedInputStream bis = null;
for (int i = 0; i< fileList.length; i++)
{
String name = fileList[i];
File file = new File(f.getAbsolutePath() + "\\" + name);
System.out.println(file.getName());
// Reset to beginning of input stream
bis = new BufferedInputStream(new FileInputStream(file));
while ((bytesRead = bis.read(buffer)) != -1)
{
System.out.println("aaaa");
out.write(buffer, 0, bytesRead);
}
bis.close();
}
out.finish();
out.close();
baos.writeTo(fos);
fos.close();
baos.close();
}
This code is creating a package, but I am not sure if that package is correct or not.
I need the following information.
Am I creating a valid Zlib file or not...
If the package is valid, then is there any tool to extract that file apart from the java.util.zip package.
PLease advice me on this...
Thanks
Raj