解壓縮的時候發現

net.lingala.zip4j.ZipFile.isEncrypted() throws net.lingala.zip4j.exception.ZipException: Expected central directory entry not found (#1)

一路追發現主要是出錯在 at net.lingala.zip4j.headers.HeaderReader.readCentralDirectory(HeaderReader.java:168)
主要為檔案有異常

然後看到「ZIP4j 压缩与解压」https://blog.csdn.net/u011165335/article/details/50496930
這篇有提到

在添加文件时,发现只能添加一次,再次添加报错:Expected central directory entry not found (#1),

 

案例1: 原解壓目標非正常方式壓縮,重新壓縮完不更動內部檔案就正常了java

案例2: 檔案下載不完全,發現使用FTP下載時少設定資料 FTPClient.setFileType
 

FTPClient client = new FTPClient();
client.connect(host, port);
client.login(account, password);
client.setFileType(FTPClient.BINARY_FILE_TYPE);  //<--- 少加這個,補上就正常了

 

arrow
arrow

    咪卡恰比 發表在 痞客邦 留言(0) 人氣()