[英]Writing streamed files into zip stream in java
I want to write multiple CSVs
generated from different tables to a zip
file without having a read/write operation required to store the generated CSV
files or the generated zip
files to a memory
. 我想将从不同表生成的multiple CSVs
写入zip
文件,而不需要将生成的CSV
文件或生成的zip
文件memory
到memory
中的读/写操作。
This zip
I need to send as an output stream to a response. 我需要将此zip
作为输出流发送给响应。 Is this possible to do in Java? 这有可能用Java做吗? If yes, then how? 如果是,那怎么样? I am using OpenCSV library
to generate CSVs
. 我正在使用OpenCSV library
生成CSVs
。
InputStream
for the csv data unit 打开csv数据单元的InputStream
InputStream
关闭InputStream
GZIPOutputStream
关闭GZIPOutputStream
If you are working with a servlet, you can wrap ServletOutputStream
with GZIPOutputStream
. 如果您正在使用servlet,则可以使用GZIPOutputStream
包装ServletOutputStream
。 If you like, I can give you more information on that. 如果您愿意,我可以为您提供更多相关信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.