java ZipOutputStream压缩图片
时间: 2023-10-22 15:02:54 浏览: 124
Java中的ZipOutputStream是一个用于压缩文件的类。它可以将文件或文件夹压缩成一个zip文件。在压缩图片的例子中,通过创建一个ZipOutputStream对象,然后使用putNextEntry方法将要压缩的文件添加到压缩文件中。在这个例子中,要压缩的图片是"D:\CaptureTest\filepath\1.jpg",压缩后的zip文件是"D:\CaptureTest\123.zip"。这个图片会被添加到zip文件中的"Image\01.jpg"路径下。接下来,通过从输入流读取文件内容,将文件内容写入到压缩文件中,最后关闭输入流和ZipOutputStream对象即可完成图片的压缩。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [JAVA压缩流(ZipOutputStream)的简单使用](https://blog.csdn.net/liu_xin_xin/article/details/122988864)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [java实现文件解压缩,ZipInputStream,ZipOutputStream](https://download.csdn.net/download/kzhzhang/7075751)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [Java批量导出图片,并压缩成zip](https://blog.csdn.net/mymyyy/article/details/124940820)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文