相关疑难解决方法(0)

使用csv文件在运行中创建一个zip

我正在尝试创建一个包含一堆csv文件的zip文件,从servlet返回它非常令人困惑.一点指导就会很棒.以下是我所拥有的代码块,它们需要一起工作:

// output stream coming from httpResponse, thats all fine
ZipOutputStream zip = new ZipOutputStream(outputStream);


// using the openCSV library to create the csv file
CSVWriter writer = new CSVWriter(Writer?); 
// what writer do I use? I want to write to memory, not a file

writer.writeNext(entries); 
writer.close();

// at this point should I have the csv file in memory somewhere? 
//and then try to copy it into the zip file?

int length;
byte[] buffer = new byte[1024 * 32];    
zip.putNextEntry(new …
Run Code Online (Sandbox Code Playgroud)

java csv zip

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

csv ×1

java ×1

zip ×1