src/share/classes/java/util/jar/Pack200.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File jdk Sdiff src/share/classes/java/util/jar

src/share/classes/java/util/jar/Pack200.java

Print this page




 557         /**
 558          * Takes a JarInputStream and converts it into a Pack200 archive.
 559          * <p>
 560          * Closes its input but not its output.  (Pack200 archives are appendable.)
 561          * <p>
 562          * The modification time and deflation hint attributes are not available,
 563          * for the JAR manifest file and its containing directory.
 564          *
 565          * @see #MODIFICATION_TIME
 566          * @see #DEFLATE_HINT
 567          * @param in a JarInputStream
 568          * @param out an OutputStream
 569          * @exception IOException if an error is encountered.
 570          */
 571         void pack(JarInputStream in, OutputStream out) throws IOException ;
 572 
 573         /**
 574          * Registers a listener for PropertyChange events on the properties map.
 575          * This is typically used by applications to update a progress bar.
 576          *







 577          * @see #properties
 578          * @see #PROGRESS
 579          * @param listener  An object to be invoked when a property is changed.
 580          * @deprecated The dependency on {@code PropertyChangeListener} creates
 581          *             a significant impediment to future modularization of the
 582          *             Java platform. This method will be removed in a future
 583          *             release.
 584          *             Applications that need to monitor progress of the packer
 585          *             can poll the value of the {@link #PROGRESS PROGRESS}
 586          *             property instead.
 587          */
 588         @Deprecated
 589         void addPropertyChangeListener(PropertyChangeListener listener) ;

 590 
 591         /**
 592          * Remove a listener for PropertyChange events, added by
 593          * the {@link #addPropertyChangeListener}.
 594          *







 595          * @see #addPropertyChangeListener
 596          * @param listener  The PropertyChange listener to be removed.
 597          * @deprecated The dependency on {@code PropertyChangeListener} creates
 598          *             a significant impediment to future modularization of the
 599          *             Java platform. This method will be removed in a future
 600          *             release.
 601          */
 602         @Deprecated
 603         void removePropertyChangeListener(PropertyChangeListener listener);
 604 
 605     }
 606 
 607     /**
 608      * The unpacker engine converts the packed stream to a JAR file.
 609      * An instance of the engine can be obtained
 610      * using {@link #newUnpacker}.
 611      * <p>
 612      * Every JAR file produced by this engine will include the string
 613      * "<tt>PACK200</tt>" as a zip file comment.
 614      * This allows a deployer to detect if a JAR archive was packed and unpacked.
 615      * <p>
 616      * Note: Unless otherwise noted, passing a <tt>null</tt> argument to a
 617      * constructor or method in this class will cause a {@link NullPointerException}
 618      * to be thrown.
 619      * <p>
 620      * This version of the unpacker is compatible with all previous versions.
 621      * @since 1.5
 622      */
 623     public interface Unpacker {
 624 


 701          * @param out a JarOutputStream.
 702          * @exception IOException if an error is encountered.
 703          */
 704         void unpack(InputStream in, JarOutputStream out) throws IOException;
 705 
 706         /**
 707          * Read a Pack200 archive, and write the encoded JAR to
 708          * a JarOutputStream.
 709          * <p>
 710          * Does not close its output.  (The output can accumulate more elements.)
 711          * @param in a File.
 712          * @param out a JarOutputStream.
 713          * @exception IOException if an error is encountered.
 714          */
 715         void unpack(File in, JarOutputStream out) throws IOException;
 716 
 717         /**
 718          * Registers a listener for PropertyChange events on the properties map.
 719          * This is typically used by applications to update a progress bar.
 720          *







 721          * @see #properties
 722          * @see #PROGRESS
 723          * @param listener  An object to be invoked when a property is changed.
 724          * @deprecated The dependency on {@code PropertyChangeListener} creates
 725          *             a significant impediment to future modularization of the
 726          *             Java platform. This method will be removed in a future
 727          *             release.
 728          *             Applications that need to monitor progress of the
 729          *             unpacker can poll the value of the {@link #PROGRESS
 730          *             PROGRESS} property instead.
 731          */
 732         @Deprecated
 733         void addPropertyChangeListener(PropertyChangeListener listener) ;

 734 
 735         /**
 736          * Remove a listener for PropertyChange events, added by
 737          * the {@link #addPropertyChangeListener}.
 738          *







 739          * @see #addPropertyChangeListener
 740          * @param listener  The PropertyChange listener to be removed.
 741          * @deprecated The dependency on {@code PropertyChangeListener} creates
 742          *             a significant impediment to future modularization of the
 743          *             Java platform. This method will be removed in a future
 744          *             release.
 745          */
 746         @Deprecated
 747         void removePropertyChangeListener(PropertyChangeListener listener);

 748     }
 749 
 750     // Private stuff....
 751 
 752     private static final String PACK_PROVIDER = "java.util.jar.Pack200.Packer";
 753     private static final String UNPACK_PROVIDER = "java.util.jar.Pack200.Unpacker";
 754 
 755     private static Class<?> packerImpl;
 756     private static Class<?> unpackerImpl;
 757 
 758     private synchronized static Object newInstance(String prop) {
 759         String implName = "(unknown)";
 760         try {
 761             Class<?> impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl;
 762             if (impl == null) {
 763                 // The first time, we must decide which class to use.
 764                 implName = java.security.AccessController.doPrivileged(
 765                     new sun.security.action.GetPropertyAction(prop,""));
 766                 if (implName != null && !implName.equals(""))
 767                     impl = Class.forName(implName);




 557         /**
 558          * Takes a JarInputStream and converts it into a Pack200 archive.
 559          * <p>
 560          * Closes its input but not its output.  (Pack200 archives are appendable.)
 561          * <p>
 562          * The modification time and deflation hint attributes are not available,
 563          * for the JAR manifest file and its containing directory.
 564          *
 565          * @see #MODIFICATION_TIME
 566          * @see #DEFLATE_HINT
 567          * @param in a JarInputStream
 568          * @param out an OutputStream
 569          * @exception IOException if an error is encountered.
 570          */
 571         void pack(JarInputStream in, OutputStream out) throws IOException ;
 572 
 573         /**
 574          * Registers a listener for PropertyChange events on the properties map.
 575          * This is typically used by applications to update a progress bar.
 576          *
 577          * <p> The default implementation of this method does nothing and has
 578          * no side-effects.</p>
 579          *
 580          * <p><b>WARNING:</b> This method is omitted from the interface
 581          * declaration in all subset Profiles of Java SE that do not include
 582          * the {@code java.beans} package. </p>
 583 
 584          * @see #properties
 585          * @see #PROGRESS
 586          * @param listener  An object to be invoked when a property is changed.
 587          * @deprecated The dependency on {@code PropertyChangeListener} creates
 588          *             a significant impediment to future modularization of the
 589          *             Java platform. This method will be removed in a future
 590          *             release.
 591          *             Applications that need to monitor progress of the packer
 592          *             can poll the value of the {@link #PROGRESS PROGRESS}
 593          *             property instead.
 594          */
 595         @Deprecated
 596         default void addPropertyChangeListener(PropertyChangeListener listener) {
 597         }
 598 
 599         /**
 600          * Remove a listener for PropertyChange events, added by
 601          * the {@link #addPropertyChangeListener}.
 602          *
 603          * <p> The default implementation of this method does nothing and has
 604          * no side-effects.</p>
 605          *
 606          * <p><b>WARNING:</b> This method is omitted from the interface
 607          * declaration in all subset Profiles of Java SE that do not include
 608          * the {@code java.beans} package. </p>
 609          *
 610          * @see #addPropertyChangeListener
 611          * @param listener  The PropertyChange listener to be removed.
 612          * @deprecated The dependency on {@code PropertyChangeListener} creates
 613          *             a significant impediment to future modularization of the
 614          *             Java platform. This method will be removed in a future
 615          *             release.
 616          */
 617         @Deprecated
 618         default void removePropertyChangeListener(PropertyChangeListener listener) {
 619         }
 620     }
 621 
 622     /**
 623      * The unpacker engine converts the packed stream to a JAR file.
 624      * An instance of the engine can be obtained
 625      * using {@link #newUnpacker}.
 626      * <p>
 627      * Every JAR file produced by this engine will include the string
 628      * "<tt>PACK200</tt>" as a zip file comment.
 629      * This allows a deployer to detect if a JAR archive was packed and unpacked.
 630      * <p>
 631      * Note: Unless otherwise noted, passing a <tt>null</tt> argument to a
 632      * constructor or method in this class will cause a {@link NullPointerException}
 633      * to be thrown.
 634      * <p>
 635      * This version of the unpacker is compatible with all previous versions.
 636      * @since 1.5
 637      */
 638     public interface Unpacker {
 639 


 716          * @param out a JarOutputStream.
 717          * @exception IOException if an error is encountered.
 718          */
 719         void unpack(InputStream in, JarOutputStream out) throws IOException;
 720 
 721         /**
 722          * Read a Pack200 archive, and write the encoded JAR to
 723          * a JarOutputStream.
 724          * <p>
 725          * Does not close its output.  (The output can accumulate more elements.)
 726          * @param in a File.
 727          * @param out a JarOutputStream.
 728          * @exception IOException if an error is encountered.
 729          */
 730         void unpack(File in, JarOutputStream out) throws IOException;
 731 
 732         /**
 733          * Registers a listener for PropertyChange events on the properties map.
 734          * This is typically used by applications to update a progress bar.
 735          *
 736          * <p> The default implementation of this method does nothing and has
 737          * no side-effects.</p>
 738          *
 739          * <p><b>WARNING:</b> This method is omitted from the interface
 740          * declaration in all subset Profiles of Java SE that do not include
 741          * the {@code java.beans} package. </p>
 742          *
 743          * @see #properties
 744          * @see #PROGRESS
 745          * @param listener  An object to be invoked when a property is changed.
 746          * @deprecated The dependency on {@code PropertyChangeListener} creates
 747          *             a significant impediment to future modularization of the
 748          *             Java platform. This method will be removed in a future
 749          *             release.
 750          *             Applications that need to monitor progress of the
 751          *             unpacker can poll the value of the {@link #PROGRESS
 752          *             PROGRESS} property instead.
 753          */
 754         @Deprecated
 755         default void addPropertyChangeListener(PropertyChangeListener listener) {
 756         }
 757 
 758         /**
 759          * Remove a listener for PropertyChange events, added by
 760          * the {@link #addPropertyChangeListener}.
 761          *
 762          * <p> The default implementation of this method does nothing and has
 763          * no side-effects.</p>
 764          *
 765          * <p><b>WARNING:</b> This method is omitted from the interface
 766          * declaration in all subset Profiles of Java SE that do not include
 767          * the {@code java.beans} package. </p>
 768          *
 769          * @see #addPropertyChangeListener
 770          * @param listener  The PropertyChange listener to be removed.
 771          * @deprecated The dependency on {@code PropertyChangeListener} creates
 772          *             a significant impediment to future modularization of the
 773          *             Java platform. This method will be removed in a future
 774          *             release.
 775          */
 776         @Deprecated
 777         default void removePropertyChangeListener(PropertyChangeListener listener) {
 778         }
 779     }
 780 
 781     // Private stuff....
 782 
 783     private static final String PACK_PROVIDER = "java.util.jar.Pack200.Packer";
 784     private static final String UNPACK_PROVIDER = "java.util.jar.Pack200.Unpacker";
 785 
 786     private static Class<?> packerImpl;
 787     private static Class<?> unpackerImpl;
 788 
 789     private synchronized static Object newInstance(String prop) {
 790         String implName = "(unknown)";
 791         try {
 792             Class<?> impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl;
 793             if (impl == null) {
 794                 // The first time, we must decide which class to use.
 795                 implName = java.security.AccessController.doPrivileged(
 796                     new sun.security.action.GetPropertyAction(prop,""));
 797                 if (implName != null && !implName.equals(""))
 798                     impl = Class.forName(implName);


src/share/classes/java/util/jar/Pack200.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File