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

解压zip文件的时候报错,原因是压缩文件中有中文;导致错误,解决办法是设置编码:

ZipFile zipOutFile = new ZipFile(zipFile,Charset.forName("gbk"));

错误:

java.lang.IllegalArgumentException: MALFORMED
at java.util.zip.ZipCoder.toString(ZipCoder.java:58)
at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:300)
at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:122)
at test.Hello.UnZipFolder(Hello.java:36)
at test.Hello.main(Hello.java:10)

 

引用:https://blog.csdn.net/u012995897/article/details/80197815

posted @ 2022-04-01 16:14  不经一番寒彻骨  阅读(2742)  评论(0编辑  收藏  举报