84 * unpacker.unpack(f, jostream);
85 * // Must explicitly close the output.
86 * jostream.close();
87 * } catch (IOException ioe) {
88 * ioe.printStackTrace();
89 * }
90 * }</pre>
91 * <p>
92 * A Pack200 file compressed with gzip can be hosted on HTTP/1.1 web servers.
93 * The deployment applications can use "Accept-Encoding=pack200-gzip". This
94 * indicates to the server that the client application desires a version of
95 * the file encoded with Pack200 and further compressed with gzip. Please
96 * refer to the Java Deployment Guide for techniques and details.
97 * <p>
98 * Unless otherwise noted, passing a {@code null} argument to a constructor or
99 * method in this class will cause a {@link NullPointerException} to be thrown.
100 *
101 * @author John Rose
102 * @author Kumar Srinivasan
103 * @since 1.5
104 */
105 public abstract class Pack200 {
106 private Pack200() {} //prevent instantiation
107
108 // Static methods of the Pack200 class.
109 /**
110 * Obtain new instance of a class that implements Packer.
111 * <ul>
112 * <li><p>If the system property {@code java.util.jar.Pack200.Packer}
113 * is defined, then the value is taken to be the fully-qualified name
114 * of a concrete implementation class, which must implement Packer.
115 * This class is loaded and instantiated. If this process fails
116 * then an unspecified error is thrown.</p></li>
117 *
118 * <li><p>If an implementation has not been specified with the system
119 * property, then the system-default implementation class is instantiated,
120 * and the result is returned.</p></li>
121 * </ul>
122 *
123 * <p>Note: The returned object is not guaranteed to operate
124 * correctly if multiple threads use it at the same time.
209 * <p>
210 * In order to maintain backward compatibility, the pack file's version is
211 * set to accommodate the class files present in the input JAR file. In
212 * other words, the pack file version will be the latest, if the class files
213 * are the latest and conversely the pack file version will be the oldest
214 * if the class file versions are also the oldest. For intermediate class
215 * file versions the corresponding pack file version will be used.
216 * For example:
217 * If the input JAR-files are solely comprised of 1.5 (or lesser)
218 * class files, a 1.5 compatible pack file is produced. This will also be
219 * the case for archives that have no class files.
220 * If the input JAR-files contains a 1.6 class file, then the pack file
221 * version will be set to 1.6.
222 * <p>
223 * Note: Unless otherwise noted, passing a {@code null} argument to a
224 * constructor or method in this class will cause a {@link NullPointerException}
225 * to be thrown.
226 *
227 * @since 1.5
228 */
229 public interface Packer {
230 /**
231 * This property is a numeral giving the estimated target size N
232 * (in bytes) of each archive segment.
233 * If a single input file requires more than N bytes,
234 * it will be given its own archive segment.
235 * <p>
236 * As a special case, a value of -1 will produce a single large
237 * segment with all input files, while a value of 0 will
238 * produce one segment for each class.
239 * Larger archive segments result in less fragmentation and
240 * better compression, but processing them requires more memory.
241 * <p>
242 * The size of each segment is estimated by counting the size of each
243 * input file to be transmitted in the segment, along with the size
244 * of its name and other transmitted properties.
245 * <p>
246 * The default is -1, which means the packer will always create a single
247 * segment output file. In cases where extremely large output files are
248 * generated, users are strongly encouraged to use segmenting or break
568 */
569 void pack(JarInputStream in, OutputStream out) throws IOException ;
570 }
571
572 /**
573 * The unpacker engine converts the packed stream to a JAR file.
574 * An instance of the engine can be obtained
575 * using {@link #newUnpacker}.
576 * <p>
577 * Every JAR file produced by this engine will include the string
578 * "{@code PACK200}" as a zip file comment.
579 * This allows a deployer to detect if a JAR archive was packed and unpacked.
580 * <p>
581 * Note: Unless otherwise noted, passing a {@code null} argument to a
582 * constructor or method in this class will cause a {@link NullPointerException}
583 * to be thrown.
584 * <p>
585 * This version of the unpacker is compatible with all previous versions.
586 * @since 1.5
587 */
588 public interface Unpacker {
589
590 /** The string "keep", a possible value for certain properties.
591 * @see #DEFLATE_HINT
592 */
593 String KEEP = "keep";
594
595 /** The string "true", a possible value for certain properties.
596 * @see #DEFLATE_HINT
597 */
598 String TRUE = "true";
599
600 /** The string "false", a possible value for certain properties.
601 * @see #DEFLATE_HINT
602 */
603 String FALSE = "false";
604
605 /**
606 * Property indicating that the unpacker should
607 * ignore all transmitted values for DEFLATE_HINT,
|
84 * unpacker.unpack(f, jostream);
85 * // Must explicitly close the output.
86 * jostream.close();
87 * } catch (IOException ioe) {
88 * ioe.printStackTrace();
89 * }
90 * }</pre>
91 * <p>
92 * A Pack200 file compressed with gzip can be hosted on HTTP/1.1 web servers.
93 * The deployment applications can use "Accept-Encoding=pack200-gzip". This
94 * indicates to the server that the client application desires a version of
95 * the file encoded with Pack200 and further compressed with gzip. Please
96 * refer to the Java Deployment Guide for techniques and details.
97 * <p>
98 * Unless otherwise noted, passing a {@code null} argument to a constructor or
99 * method in this class will cause a {@link NullPointerException} to be thrown.
100 *
101 * @author John Rose
102 * @author Kumar Srinivasan
103 * @since 1.5
104 * @deprecated This class has been deprecated
105 */
106 @Deprecated(since="11", forRemoval=true)
107 public abstract class Pack200 {
108 private Pack200() {} //prevent instantiation
109
110 // Static methods of the Pack200 class.
111 /**
112 * Obtain new instance of a class that implements Packer.
113 * <ul>
114 * <li><p>If the system property {@code java.util.jar.Pack200.Packer}
115 * is defined, then the value is taken to be the fully-qualified name
116 * of a concrete implementation class, which must implement Packer.
117 * This class is loaded and instantiated. If this process fails
118 * then an unspecified error is thrown.</p></li>
119 *
120 * <li><p>If an implementation has not been specified with the system
121 * property, then the system-default implementation class is instantiated,
122 * and the result is returned.</p></li>
123 * </ul>
124 *
125 * <p>Note: The returned object is not guaranteed to operate
126 * correctly if multiple threads use it at the same time.
211 * <p>
212 * In order to maintain backward compatibility, the pack file's version is
213 * set to accommodate the class files present in the input JAR file. In
214 * other words, the pack file version will be the latest, if the class files
215 * are the latest and conversely the pack file version will be the oldest
216 * if the class file versions are also the oldest. For intermediate class
217 * file versions the corresponding pack file version will be used.
218 * For example:
219 * If the input JAR-files are solely comprised of 1.5 (or lesser)
220 * class files, a 1.5 compatible pack file is produced. This will also be
221 * the case for archives that have no class files.
222 * If the input JAR-files contains a 1.6 class file, then the pack file
223 * version will be set to 1.6.
224 * <p>
225 * Note: Unless otherwise noted, passing a {@code null} argument to a
226 * constructor or method in this class will cause a {@link NullPointerException}
227 * to be thrown.
228 *
229 * @since 1.5
230 */
231 @Deprecated(since="11", forRemoval=true)
232 public interface Packer {
233 /**
234 * This property is a numeral giving the estimated target size N
235 * (in bytes) of each archive segment.
236 * If a single input file requires more than N bytes,
237 * it will be given its own archive segment.
238 * <p>
239 * As a special case, a value of -1 will produce a single large
240 * segment with all input files, while a value of 0 will
241 * produce one segment for each class.
242 * Larger archive segments result in less fragmentation and
243 * better compression, but processing them requires more memory.
244 * <p>
245 * The size of each segment is estimated by counting the size of each
246 * input file to be transmitted in the segment, along with the size
247 * of its name and other transmitted properties.
248 * <p>
249 * The default is -1, which means the packer will always create a single
250 * segment output file. In cases where extremely large output files are
251 * generated, users are strongly encouraged to use segmenting or break
571 */
572 void pack(JarInputStream in, OutputStream out) throws IOException ;
573 }
574
575 /**
576 * The unpacker engine converts the packed stream to a JAR file.
577 * An instance of the engine can be obtained
578 * using {@link #newUnpacker}.
579 * <p>
580 * Every JAR file produced by this engine will include the string
581 * "{@code PACK200}" as a zip file comment.
582 * This allows a deployer to detect if a JAR archive was packed and unpacked.
583 * <p>
584 * Note: Unless otherwise noted, passing a {@code null} argument to a
585 * constructor or method in this class will cause a {@link NullPointerException}
586 * to be thrown.
587 * <p>
588 * This version of the unpacker is compatible with all previous versions.
589 * @since 1.5
590 */
591 @Deprecated(since="11", forRemoval=true)
592 public interface Unpacker {
593
594 /** The string "keep", a possible value for certain properties.
595 * @see #DEFLATE_HINT
596 */
597 String KEEP = "keep";
598
599 /** The string "true", a possible value for certain properties.
600 * @see #DEFLATE_HINT
601 */
602 String TRUE = "true";
603
604 /** The string "false", a possible value for certain properties.
605 * @see #DEFLATE_HINT
606 */
607 String FALSE = "false";
608
609 /**
610 * Property indicating that the unpacker should
611 * ignore all transmitted values for DEFLATE_HINT,
|