Provides stream classes for compressing and decompressing streams using the Pack200 algorithm used to compress Java archives.
The streams of this package only work on JAR archives, i.e. a
Pack200CompressorOutputStream expects to be wrapped around a
stream that a valid JAR archive will be written to and a
Pack200CompressorInputStream provides a stream to read from a
JAR archives compressed with Pack200 will in general be different from the original archive when decompressed again. For details see the API documentation of Pack200.
The streams of this package work on non-deflated streams,
i.e. archives like those created with the
option of the JDK's
pack200 command line tool. If
you want to work on deflated streams you must use an additional
stream layer - for example by using Apache Commons Compress'
The Pack200 API provided by the Java class library doesn't lend
itself to real stream
uncompress its input immediately and then provide
InputStream to a cached result.
Pack200CompressorOutputStream will not
write anything to the given OutputStream
close is called - at
which point the cached output written so far gets
Two different caching modes are available - "in memory", which is the default, and "temporary file". By default data is cached in memory but you should switch to the temporary file option if your archives are really big.
Given there always is an intermediate result
Pack200CompressorInputStream are meaningless
(read from the real stream or from the intermediate result?)
and always return 0.
During development of the initial version several attempts have
been made to use a real streaming API based for example
Piped(In|Out)putStream or explicit stream
pumping like Commons Exec's
they have all failed because they rely on the output end to be
consumed completely or else the
(un)pack will block
forever. Especially for
Pack200InputStream it is
very likely that it will be wrapped in
ZipArchiveInputStream which will never read the
archive completely as it is not interested in the ZIP central
directory data at the end of the JAR archive.
Class Summary Class Description Pack200CompressorInputStreamAn input stream that decompresses from the Pack200 format to be read as any other stream. Pack200CompressorOutputStreamAn output stream that compresses using the Pack200 format. Pack200UtilsUtility methods for Pack200.
Enum Summary Enum Description Pack200StrategyThe different modes the Pack200 streams can use to wrap input and output.