|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ZipEntryCompressionMethod
This interface defines a file compression method that may occur in a Zip
file. Zip compression method objects is used by the
ZipFile
object to handle decompression of file data, and
by the ZipBuilder
to handle compression of file
data.
Each compression method is identified by a unique code. The
ZipEntryCompressionMethodRegistry
can be used to look up a
compression method by its code.
Some implementations of this interface does not have any configurable internal state and can thus be used as singleton objects. All implementations are immutable.
ZipEntryCompressionMethodRegistry
,
ZipEntryCompressionMethodFactory
Method Summary | |
---|---|
InputStream |
createInputStream(InputStream is,
long compressedSize,
long uncompressedSize)
Create an InputStream that clients can use to read uncompressed
file data from. |
OutputStream |
createOutputStream(OutputStream os)
Create an OutputStream that compresses the data written to it and
writes it to the wrapped output stream. |
RandomAccess |
createRandomAccess(RandomAccess ra,
long compressedSize,
long uncompressedSize)
Open a read only random access object on the file entry's data. |
ZipEntryCompressionMethod |
createWithCompressionLevel(CompressionLevel level)
Create a new ZipEntryCompressionMethod object that will have the
supplied compression level. |
UnsignedShort |
getCode()
Get the unique code that is used to identify this compression method in a Zip entry's header. |
String |
getName()
Get a human-readable name for the compression method. |
UnsignedShort |
getVersionNeededToExtract()
Get the PK-Zip version needed to extract Zip entries compressed by this compression method. |
boolean |
isRandomAccessSupported()
Does this compression method support read only random access on uncompressed file data? |
Method Detail |
---|
UnsignedShort getCode()
String getName()
UnsignedShort getVersionNeededToExtract()
UnsignedShort
representing the version number. 10
corresponds to version 1.0, 62
to 6.2, etc.InputStream createInputStream(InputStream is, long compressedSize, long uncompressedSize) throws IOException, UnsupportedCompressionMethodException, ZipFileParseException
InputStream
that clients can use to read uncompressed
file data from.
is
- An open InputStream
on the compressed file data.compressedSize
- The total size of the compressed data.uncompressedSize
- The total size of the uncompressed data.
InputStream
containing uncompressed file data.
IOException
- On I/O errors.
UnsupportedCompressionMethodException
- If the compression method
is not supported.
ZipFileParseException
- On parse errors.boolean isRandomAccessSupported()
Random access is only supported by the compression methods that don't
have a position-based state for the compressed data (which currently all
compressing compression methods have). In other words, this is only
supported if the file is stored uncompressed in the archive using the
StoredCompressionMethod
.
true
if the compression method supports read only random
access on file data.RandomAccess createRandomAccess(RandomAccess ra, long compressedSize, long uncompressedSize) throws IOException, UnsupportedCompressionMethodException, UnsupportedOperationException, ZipFileParseException
ra
- An open random access object on the file entry's data.compressedSize
- The total size of the compressed data.uncompressedSize
- The total size of the uncompressed data.
RandomAccess
that can be used to read
uncompressed data.
IOException
- On I/O errors.
UnsupportedCompressionMethodException
- If the compression method
is not implemented.
UnsupportedOperationException
- If the compression method does not
support random access to uncompressed file data.
ZipFileParseException
- On parse errors.OutputStream createOutputStream(OutputStream os) throws IOException, UnsupportedCompressionMethodException
OutputStream
that compresses the data written to it and
writes it to the wrapped output stream. This is used when building Zip
files.
os
- The wrapped output stream.
IOException
- On I/O errors.
UnsupportedCompressionMethodException
- If the compression method
is not supported.ZipEntryCompressionMethod createWithCompressionLevel(CompressionLevel level)
ZipEntryCompressionMethod
object that will have the
supplied compression level.
The reason for this method is that it makes it easier to set a custom compression level for a compression method, without having to create a new compression method object from scratch manually.
level
- The compression level.
this
since ZipEntryCompressionMethod
objects are
immutable.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |