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

在解压文件的时候报错,原因是压缩文件中有中文;导致错误,解决办法是设置编码:
ZipFile zipOutFile = new ZipFile(zipFile,Charset.forName(“gbk”));


Exception in thread "main" java.lang.IllegalArgumentException: MALFORMED
	at java.util.zip.ZipCoder.toString(ZipCoder.java:58)
	at java.util.zip.ZipFile.getZipEntry(ZipFile.java:529)
	at java.util.zip.ZipFile.access$900(ZipFile.java:56)
	at java.util.zip.ZipFile$1.nextElement(ZipFile.java:511)
	at java.util.zip.ZipFile$1.nextElement(ZipFile.java:481)
	at org.meter.zip.ZipTools.unzip(ZipTools.java:264)
	at org.meter.zip.ZipTools.main(ZipTools.java:296)

你可能感兴趣的:(java)