问题解决:Java解压文件时报错:MALFORMED

分享 未结 0 750
你的瓦刀
你的瓦刀 站长 2020年4月22日 20:26 编辑
点击群号免费加入尼特社区交流群:813128395
<p id="descriptionP"><blockquote style="outline: 0px; overflow-wrap: break-word; color: rgb(51, 51, 51); font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;"><p>Exception in thread "main" java.lang.IllegalArgumentException: MALFORMED<br> at java.util.zip.ZipCoder.toString(ZipCoder.java:58)<br> at java.util.zip.ZipFile.getZipEntry(ZipFile.java:529)<br> at java.util.zip.ZipFile.access$900(ZipFile.java:56)<br> at java.util.zip.ZipFile$1.nextElement(ZipFile.java:511)<br> at java.util.zip.ZipFile$1.nextElement(ZipFile.java:481)<br> at org.meter.zip.ZipTools.unzip(ZipTools.java:264)<br> at org.meter.zip.ZipTools.main(ZipTools.java:296)</p></blockquote><div style="outline: 0px; overflow-wrap: break-word; color: rgb(51, 51, 51); font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;"><span style="outline: 0px; font-family: KaiTi_GB2312; overflow-wrap: break-word; font-size: 18px; color: rgb(255, 0, 0);"><span style="outline: 0px; font-weight: 700; overflow-wrap: break-word;">在解压文件的时候报错,原因是压缩文件中有中文;导致错误,解决办法是设置编码:</span></span></div><pre class="layui-box layui-code-view"><h3 class="layui-code-h3" id="4fb81383-6dc7-576c-ce92-07d50bd74410">code</h3><ol class="layui-code-ol" style="max-height: 500px;"><li><code>ZipFile zipOutFile = new ZipFile(zipFile,Charset.forName("gbk"));</code></li></ol></pre><p></p></p><p><img src="https://niter.cn/images/logo.png" style="max-width:100%;"><br></p>
收藏(0)  分享
相关标签: java 解压
注意:本文归作者所有,未经作者允许,不得转载
0个回复
  • 消灭零回复