Back to project page magdaa-library.
The source code is released under:
GNU General Public License
If you think the Android project magdaa-library listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.zeroturnaround.zip.transform; /*from ww w .j a va 2s . c om*/ import java.io.IOException; import java.io.InputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import org.apache.commons.io.IOUtils; import org.zeroturnaround.zip.ByteSource; public abstract class ByteArrayZipEntryTransformer implements ZipEntryTransformer { /** * Transforms the given byte array into a new one. */ protected abstract byte[] transform(ZipEntry zipEntry, byte[] input) throws IOException; public void transform(InputStream in, ZipEntry zipEntry, ZipOutputStream out) throws IOException { byte[] bytes = IOUtils.toByteArray(in); bytes = transform(zipEntry, bytes); ByteSource source; if (preserveTimestamps()) { source = new ByteSource(zipEntry.getName(), bytes, zipEntry.getTime()); } else { source = new ByteSource(zipEntry.getName(), bytes); } ZipEntrySourceZipEntryTransformer.addEntry(source, out); } /** * Override to return true if needed. */ protected boolean preserveTimestamps() { return false; } }