throw new IllegalArgumentException("Method must be set on zipArchiveEntry: " + zipArchiveEntry); final ZipArchiveEntryRequest zipArchiveEntryRequest = createZipArchiveEntryRequest(zipArchiveEntry, source); return new Callable<Object>() { @Override
private ZipArchiveEntryRequest createEntry( final ZipArchiveEntry zipArchiveEntry, final InputStreamSupplier inputStreamSupplier ) throws IOException { // if we re-compress the zip files there is no need to look at the input stream if ( compressAddedZips ) { return createZipArchiveEntryRequest( zipArchiveEntry, inputStreamSupplier ); } // otherwise we should inspect the first four bites to see if the input stream is zip file or not InputStream is = inputStreamSupplier.get(); byte[] header = new byte[4]; try { int read = is.read( header ); int compressionMethod = zipArchiveEntry.getMethod(); if ( isZipHeader( header ) ) { compressionMethod = ZipEntry.STORED; } zipArchiveEntry.setMethod( compressionMethod ); return createZipArchiveEntryRequest( zipArchiveEntry, prependBytesToStream( header, read, is ) ); } catch ( IOException e ) { IOUtil.close( is ); throw e; } }
directories.addArchiveEntry( createZipArchiveEntryRequest( zipArchiveEntry, createInputStreamSupplier( payload ) ) ); metaInfDir.addArchiveEntry( createZipArchiveEntryRequest( zipArchiveEntry, createInputStreamSupplier( payload ) ) ); manifest.addArchiveEntry( createZipArchiveEntryRequest( zipArchiveEntry, createInputStreamSupplier( payload ) ) );
throw new IllegalArgumentException("Method must be set on zipArchiveEntry: " + zipArchiveEntry); final ZipArchiveEntryRequest zipArchiveEntryRequest = createZipArchiveEntryRequest(zipArchiveEntry, source); return new Callable<Object>() { @Override
public void addEntry(ZipArchiveEntry zipArchiveEntry, InputStreamSupplier streamSupplier) throws IOException { if (zipArchiveEntry.isDirectory() && !zipArchiveEntry.isUnixSymlink()) dirs.addArchiveEntry(ZipArchiveEntryRequest.createZipArchiveEntryRequest(zipArchiveEntry, streamSupplier)); else scatterZipCreator.addArchiveEntry(zipArchiveEntry, streamSupplier); }