问题
I am using the following method to filter out META-INF folder and its contents:
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();
}
Method found here: https://stackoverflow.com/a/22433569/3952266
The only problem is that when it creates the new file it only outputs a file a tenth of the original size.
来源:https://stackoverflow.com/questions/30859295/removing-a-jar-files-meta-inf-folder-in-java