JarInputStream


JarInputStream java.util.jar

Java 1.2 closeable

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.JarInputStream

 public 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 To

Pack200.Packer.pack( )



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net