/** * Add an archive entry to this scatter stream. * * @param zipArchiveEntryRequest The entry to write. * @throws IOException If writing fails */ public void addArchiveEntry(final ZipArchiveEntryRequest zipArchiveEntryRequest) throws IOException { try (final InputStream payloadStream = zipArchiveEntryRequest.getPayloadStream()) { streamCompressor.deflate(payloadStream, zipArchiveEntryRequest.getMethod()); } items.add(new CompressedEntry(zipArchiveEntryRequest, streamCompressor.getCrc32(), streamCompressor.getBytesWrittenForLastEntry(), streamCompressor.getBytesRead())); }
/** * Writes all necessary data for this entry. * @throws IOException on error * @throws Zip64RequiredException if the entry's uncompressed or * compressed size exceeds 4 GByte and {@link #setUseZip64} * is {@link Zip64Mode#Never}. */ @Override public void closeArchiveEntry() throws IOException { preClose(); flushDeflater(); final long bytesWritten = streamCompressor.getTotalBytesWritten() - entry.dataStart; final long realCrc = streamCompressor.getCrc32(); entry.bytesRead = streamCompressor.getBytesRead(); final Zip64Mode effectiveMode = getEffectiveZip64Mode(entry.entry); final boolean actuallyNeedsZip64 = handleSizesAndCrc(bytesWritten, realCrc, effectiveMode); closeEntry(actuallyNeedsZip64, false); streamCompressor.reset(); }
/** * Add an archive entry to this scatter stream. * * @param zipArchiveEntryRequest The entry to write. * @throws IOException If writing fails */ public void addArchiveEntry(final ZipArchiveEntryRequest zipArchiveEntryRequest) throws IOException { try (final InputStream payloadStream = zipArchiveEntryRequest.getPayloadStream()) { streamCompressor.deflate(payloadStream, zipArchiveEntryRequest.getMethod()); } items.add(new CompressedEntry(zipArchiveEntryRequest, streamCompressor.getCrc32(), streamCompressor.getBytesWrittenForLastEntry(), streamCompressor.getBytesRead())); }
/** * Writes all necessary data for this entry. * @throws IOException on error * @throws Zip64RequiredException if the entry's uncompressed or * compressed size exceeds 4 GByte and {@link #setUseZip64} * is {@link Zip64Mode#Never}. */ @Override public void closeArchiveEntry() throws IOException { preClose(); flushDeflater(); final long bytesWritten = streamCompressor.getTotalBytesWritten() - entry.dataStart; final long realCrc = streamCompressor.getCrc32(); entry.bytesRead = streamCompressor.getBytesRead(); final Zip64Mode effectiveMode = getEffectiveZip64Mode(entry.entry); final boolean actuallyNeedsZip64 = handleSizesAndCrc(bytesWritten, realCrc, effectiveMode); closeEntry(actuallyNeedsZip64, false); streamCompressor.reset(); }