简体   繁体   English

将byte [](来自plsql)写入文件,而无需保存到物理路径并压缩它

[英]Write byte[](from plsql) into a file without saving into the physical path & ZIP it

Working with Spring Boot + Spring JPA + Web service. 使用Spring Boot + Spring JPA + Web服务。 Currently I'm reading the byte[] from plsql, and writing it into a JSON file by specifying the local file path. 目前,我正在从plsql中读取byte [],并通过指定本地文件路径将其写入JSON文件。

But the requirement is to write the byte[] into a file without actually saving the file into a physical path. 但是要求是将byte []写入文件,而无需实际将文件保存到物理路径。 Instead I need it in ZIP(And this Zip too should be downloaded or passed as it is in a response body). 取而代之的是,我需要ZIP(它也应该下载或传递,因为它在响应正文中)。 Is there any possibility of not storing these files at all? 是否有可能根本不存储这些文件?

In my opinion, there's no way you can generate a zip folder without storing it localy. 我认为,如果不本地存储,就无法生成zip文件夹。

Here's what I'd do: create a zip folder in a temp directory (let's say temp/myzip_{timestamp}), return it to the user and then remove it from the temp directory. 我要做的是:在temp目录中创建一个zip文件夹(假设为temp / myzip_ {timestamp}),将其返回给用户,然后将其从temp目录中删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM