Examples of ZipEntryTransformer


Examples of org.zeroturnaround.zip.transform.ZipEntryTransformer

      finally {
        IOUtils.closeQuietly(zos);
      }

      // Transform the ZIP file
      ZipEntryTransformer transformer = new ByteArrayZipEntryTransformer() {
        protected byte[] transform(ZipEntry zipEntry, byte[] input) throws IOException {
          String s = new String(input);
          assertEquals(new String(contents), s);
          return s.toUpperCase().getBytes();
        }
View Full Code Here

Examples of org.zeroturnaround.zip.transform.ZipEntryTransformer

      }
      finally {
        IOUtils.closeQuietly(zos);
      }
      // Transform the ZIP file
      ZipEntryTransformer transformer = new ByteArrayZipEntryTransformer() {
        protected byte[] transform(ZipEntry zipEntry, byte[] input) throws IOException {
          String s = new String(input);
          assertEquals(new String(contents), s);
          return s.toUpperCase().getBytes();
        }
View Full Code Here

Examples of org.zeroturnaround.zip.transform.ZipEntryTransformer

    File newEntry = new File("src/test/resources/" + fileName);

    File src = new File("src/test/resources/demo-dirs.zip");
    File dest = File.createTempFile("temp", ".zip");
    try {
      ZipEntryTransformer transformer = new ByteArrayZipEntryTransformer() {
        protected byte[] transform(ZipEntry zipEntry, byte[] input) throws IOException {
          String s = new String(input);
          return s.toUpperCase().getBytes();
        }
View Full Code Here

Examples of org.zeroturnaround.zip.transform.ZipEntryTransformer

    File newEntry = new File("src/test/resources/" + fileName);

    File src = new File("src/test/resources/demo-dirs.zip");
    File dest = File.createTempFile("temp", ".zip");
    try {
      ZipEntryTransformer transformer = new ByteArrayZipEntryTransformer() {
        protected byte[] transform(ZipEntry zipEntry, byte[] input) throws IOException {
          String s = new String(input);
          byte[] result = s.toUpperCase().getBytes();
          return result;
        }
View Full Code Here

Examples of org.zeroturnaround.zip.transform.ZipEntryTransformer

      if (visitedNames.contains(entryName)) {
        return;
      }
      visitedNames.add(entryName);

      ZipEntryTransformer transformer = (ZipEntryTransformer) entryByPath.remove(entryName);
      if (transformer == null) { // no transformer
        ZipEntryUtil.copyEntry(zipEntry, in, out, preserveTimestapms);
      }
      else { // still transfom entry
        transformer.transform(in, zipEntry, out);
      }
    }
View Full Code Here

Examples of org.zeroturnaround.zip.transform.ZipEntryTransformer

      else {
        FileUtils.forceMkdir(file.getParentFile());
        file.createNewFile();
      }

      ZipEntryTransformer transformer = (ZipEntryTransformer) entryByPath.remove(entryName);
      if (transformer == null) { // no transformer
        FileUtils.copy(in, file);
      }
      else { // still transform entry
        transformIntoFile(transformer, in, zipEntry, file);
View Full Code Here

Examples of org.zeroturnaround.zip.transform.ZipEntryTransformer

      this.out = out;
    }

    public void process(InputStream in, ZipEntry zipEntry) throws IOException {
      if (names.add(zipEntry.getName())) {
        ZipEntryTransformer entry = (ZipEntryTransformer) entryByPath.remove(zipEntry.getName());
        if (entry != null) {
          entry.transform(in, zipEntry, out);
        }
        else {
          ZipEntryUtil.copyEntry(zipEntry, in, out);
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.