-2
我正在创建一个.csv文件,并且它是在指定的位置创建的,现在我想在同一位置压缩该文件,因此对于这个我是用来制作分离方法的东西将采取的位置在哪里是压缩文件保存和文件名作为参数,请告知如何使这个方法有荏苒逻辑,我已经尝试了这个..通过Java压缩文件
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
什么是您所遇到的问题? –
@MattClark请注意逻辑,我对此坚持,在此先感谢 –
@SoniSahai有直接类来实现这个 –