public void transform ( InputStream in , ZipEntry zipEntry , ZipOutputStream out ) throws IOException { File inFile = null ; File outFile = null ; try { inFile = File . createTempFile ( "zip" , null ) ; outFile = File . createTempFile ( "zip" , null ) ; copy ( in , inFile ) ; transform ( zipEntry , inFile , outFile ) ; FileSource source = new FileSource ( zipEntry . getName ( ) , outFile ) ; ZipEntrySourceZipEntryTransformer . addEntry ( source , out ) ; } finally { FileUtils . deleteQuietly ( inFile ) ; FileUtils . deleteQuietly ( outFile ) ; } }
Copies the input stream to the file then transforms the file . FileSource is added then to the output stream .