List of usage examples for org.apache.commons.compress.changes ChangeSet add
public void add(final ArchiveEntry pEntry, final InputStream pInput)
From source file:org.obm.sync.ObmSyncArchiveUtils.java
private static File[] replaceServiceJar(File[] asFile) { return FluentIterable.from(Arrays.asList(asFile)).transform(new Function<File, File>() { @Override//from w w w .j ava 2s. c o m public File apply(File input) { if (input.getName().contains("services-module")) { ZipFile servicesZip = null; try { File outputFile = File.createTempFile("services-module", ".jar"); servicesZip = new ZipFile(input); ChangeSet changeSet = new ChangeSet(); changeSet.add(new JarArchiveEntry("META-INF/MANIFEST.MF"), ClassLoader.getSystemClassLoader().getResourceAsStream("MANIFEST.MF")); ChangeSetPerformer changeSetPerformer = new ChangeSetPerformer(changeSet); JarArchiveOutputStream jarArchiveOutputStream = new JarArchiveOutputStream( new FileOutputStream(outputFile)); changeSetPerformer.perform(servicesZip, jarArchiveOutputStream); return outputFile; } catch (IOException e) { Throwables.propagate(e); } finally { try { if (servicesZip != null) { servicesZip.close(); } } catch (IOException e) { Throwables.propagate(e); } } } return input; } }).toArray(File.class); }