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.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public void writeCounted(byte[] data) throws java.io.IOException
java.io.IOException
public void writeCounted(byte[] data, int offset, int length) throws java.io.IOException
java.io.IOException
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"