Class FileZipEntryTransformer

java.lang.Object
org.zeroturnaround.zip.transform.FileZipEntryTransformer
All Implemented Interfaces:
ZipEntryTransformer

public abstract class FileZipEntryTransformer extends Object implements ZipEntryTransformer
  • Constructor Details

    • FileZipEntryTransformer

      public FileZipEntryTransformer()
  • Method Details

    • transform

      protected abstract void transform(ZipEntry zipEntry, File in, File out) throws IOException
      Copies and transforms the given file into the output file.
      Parameters:
      zipEntry - zip entry metadata
      in - zip entry contents
      out - file to write transformed contents
      Throws:
      IOException - if file is not found or writing to it fails
    • transform

      public void transform(InputStream in, ZipEntry zipEntry, ZipOutputStream out) throws IOException
      Copies the input stream to the file, then transforms the file. FileSource is added then to the output stream.
      Specified by:
      transform in interface ZipEntryTransformer
      Parameters:
      in - input stream of the entry contents
      zipEntry - zip entry metadata
      out - ignored, because we're working on files
      Throws:
      IOException - if anything goes wrong
    • copy

      private static void copy(InputStream in, File file) throws IOException
      Throws:
      IOException