public abstract class StreamCompressor
extends java.lang.Object
implements java.io.Closeable
Deflater and crc calculator, handling multiple types of output streams.
Currently ZipEntry.DEFLATED and ZipEntry.STORED are the only
supported compression methods.| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static StreamCompressor |
create(int compressionLevel,
ScatterGatherBackingStore bs)
Create a stream compressor with the given compression level.
|
static StreamCompressor |
create(ScatterGatherBackingStore bs)
Create a stream compressor with the default compression level.
|
void |
deflate(java.io.InputStream source,
int method)
Deflate the given source using the supplied compression method
|
long |
getBytesRead()
Return the number of bytes read from the source stream
|
long |
getBytesWrittenForLastEntry()
The number of bytes written to the output for the last entry
|
long |
getCrc32()
The crc32 of the last deflated file
|
long |
getTotalBytesWritten()
The total number of bytes written to the output for all files
|
void |
writeCounted(byte[] data) |
void |
writeCounted(byte[] data,
int offset,
int length) |
public static StreamCompressor create(int compressionLevel, ScatterGatherBackingStore bs)
compressionLevel - The Deflater compression levelbs - The ScatterGatherBackingStore to receive outputpublic static StreamCompressor create(ScatterGatherBackingStore bs)
bs - The ScatterGatherBackingStore to receive outputpublic long getCrc32()
public long getBytesRead()
public long getBytesWrittenForLastEntry()
public long getTotalBytesWritten()
public void deflate(java.io.InputStream source,
int method)
throws java.io.IOException
source - The source to compressmethod - The #ZipArchiveEntry compression methodjava.io.IOException - When failures happenpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic void writeCounted(byte[] data)
throws java.io.IOException
java.io.IOExceptionpublic void writeCounted(byte[] data,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionCopyright © 2010 - 2023 Adobe. All Rights Reserved