zipping the file through Java
I am creating a .csv file and it is get created at the specified loaction
, now I want to zip that file in the same location , so for this I was
thing a to make a seprate method which will take the location where to be
zipped file kept and the filename as a parameter please advise how to make
this method and have the zipping logic , I have tried this..
File file = new File(Path + s) //path contain the location of file and s
contain the filename
for (File f : new File(mcrpFilePath).listFiles()) {
if (f.getName().endsWith(".csv")) {
if (f.isFile() && file.getName().toLowerCase().endsWith(".csv")) {
f.delete();
}
}
file.createNewFile();
FileOutputStream fileOutput = new FileOutputStream(file);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
fileOutput));
addContent(aalist, bblist, bw);// seprate method that is writing in csv file
bw.close();
fileOutput.close();
// ???? Now here i want to call my zipp method seprately
zipafile(Path + s) //?? what will be logic inside this method to zip
the file
No comments:
Post a Comment