1<html> 2<!-- 3 4 Licensed to the Apache Software Foundation (ASF) under one or more 5 contributor license agreements. See the NOTICE file distributed with 6 this work for additional information regarding copyright ownership. 7 The ASF licenses this file to You under the Apache License, Version 2.0 8 (the "License"); you may not use this file except in compliance with 9 the License. You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19--> 20 <body> 21 <p>Provides stream classes for compressing and decompressing 22 streams using the Pack200 algorithm used to compress Java 23 archives.</p> 24 25 <p>The streams of this package only work on JAR archives, i.e. a 26 {@link 27 org.apache.commons.compress.compressors.pack200.Pack200CompressorOutputStream 28 Pack200CompressorOutputStream} expects to be wrapped around a 29 stream that a valid JAR archive will be written to and a {@link 30 org.apache.commons.compress.compressors.pack200.Pack200CompressorInputStream 31 Pack200CompressorInputStream} provides a stream to read from a 32 JAR archive.</p> 33 34 <p>JAR archives compressed with Pack200 will in general be 35 different from the original archive when decompressed again. 36 For details see 37 the <a href="https://download.oracle.com/javase/1.5.0/docs/api/java/util/jar/Pack200.html">API 38 documentation of Pack200</a>.</p> 39 40 <p>The streams of this package work on non-deflated streams, 41 i.e. archives like those created with the <code>--no-gzip</code> 42 option of the JDK's <code>pack200</code> command line tool. If 43 you want to work on deflated streams you must use an additional 44 stream layer - for example by using Apache Commons Compress' 45 gzip package.</p> 46 47 <p>The Pack200 API provided by the Java class library doesn't lend 48 itself to real stream 49 processing. <code>Pack200CompressorInputStream</code> will 50 uncompress its input immediately and then provide 51 an <code>InputStream</code> to a cached result. 52 Likewise <code>Pack200CompressorOutputStream</code> will not 53 write anything to the given OutputStream 54 until <code>finish</code> or <code>close</code> is called - at 55 which point the cached output written so far gets 56 compressed.</p> 57 58 <p>Two different caching modes are available - "in memory", which 59 is the default, and "temporary file". By default data is cached 60 in memory but you should switch to the temporary file option if 61 your archives are really big.</p> 62 63 <p>Given there always is an intermediate result 64 the <code>getBytesRead</code> and <code>getCount</code> methods 65 of <code>Pack200CompressorInputStream</code> are meaningless 66 (read from the real stream or from the intermediate result?) 67 and always return 0.</p> 68 69 <p>During development of the initial version several attempts have 70 been made to use a real streaming API based for example 71 on <code>Piped(In|Out)putStream</code> or explicit stream 72 pumping like Commons Exec's <code>InputStreamPumper</code> but 73 they have all failed because they rely on the output end to be 74 consumed completely or else the <code>(un)pack</code> will block 75 forever. Especially for <code>Pack200InputStream</code> it is 76 very likely that it will be wrapped in 77 a <code>ZipArchiveInputStream</code> which will never read the 78 archive completely as it is not interested in the ZIP central 79 directory data at the end of the JAR archive.</p> 80 81 </body> 82</html> 83