我使用以下方法过滤掉META-INF文件夹及其内容:
public static void copyWithoutMetaInf(final String originalZip, final String newZip) throws IOException
{
final ZipInputStream zip = new ZipInputStream(new FileInputStream(originalZip));
final ZipOutputStream zop = new ZipOutputStream(new FileOutputStream(newZip));
ZipEntry entry;
while((entry = zip.getNextEntry()) != null)
{
if(!entry.getName().contains("META-INF"))
{
zop.putNextEntry(entry);
}
}
zip.close();
zop.close();
}
此处的方法:https://stackoverflow.com/a/22433569/3952266
唯一的问题是,当它创建新文件时,它只输出一个原始大小的十分之一的文件。