This class allows a JAR file to be read from an input stream. It extends java.util.ZipInputStream and is used much like that class is used. To create a JarInputStream , simply specify the InputStream from which to read. If you do not want the JarInputStream to attempt to verify any digital signatures contained in the JAR file, pass false as the second argument to the JarInputStream( ) constructor. The JarInputStream( ) constructor first reads the JAR manifest entry, if one exists. The manifest must be the first entry in the JAR file. getManifest( ) returns the Manifest object for the JAR file. Once you have created a JarInputStream , call getNextJarEntry( ) or getNextEnTRy( ) to obtain the JarEntry or java.util.zip.ZipEntry object that describes the next entry in the JAR file. Then, call a read( ) method (including the inherited versions) to read the contents of that entry. When the stream reaches the end of file, call getNextJarEntry( ) again to start reading the next entry in the file. When all entries have been read from the JAR file, getNextJarEntry( ) and getNextEntry( ) return null . Figure 16-111. java.util.jar.JarInputStreampublic class JarInputStream extends java.util.zip.ZipInputStream { // Public Constructors public JarInputStream (java.io.InputStream in ) throws java.io.IOException; public JarInputStream (java.io.InputStream in , boolean verify ) throws java.io.IOException; // Public Instance Methods public Manifest getManifest ( ); public JarEntry getNextJarEntry ( ) throws java.io.IOException; // Public Methods Overriding ZipInputStream public java.util.zip.ZipEntry getNextEntry ( ) throws java.io.IOException; public int read (byte[ ] b , int off , int len ) throws java.io.IOException; // Protected Methods Overriding ZipInputStream protected java.util.zip.ZipEntry createZipEntry (String name ); } Passed ToPack200.Packer.pack( ) |