java.util.jar
Class JarFile
- java.util.zip.ZipConstants
Representation of a jar file.
Note that this class is not a subclass of java.io.File but a subclass of
java.util.zip.ZipFile and you can only read JarFiles with it (although
there are constructors that take a File object).
CENATT , CENATX , CENCOM , CENCRC , CENDSK , CENEXT , CENFLG , CENHDR , CENHOW , CENLEN , CENNAM , CENOFF , CENSIG , CENSIZ , CENTIM , CENVEM , CENVER , ENDCOM , ENDHDR , ENDOFF , ENDSIG , ENDSIZ , ENDSUB , ENDTOT , EXTCRC , EXTHDR , EXTLEN , EXTSIG , EXTSIZ , LOCCRC , LOCEXT , LOCFLG , LOCHDR , LOCHOW , LOCLEN , LOCNAM , LOCSIG , LOCSIZ , LOCTIM , LOCVER |
JarFile(File file) - Creates a new JarFile.
|
JarFile(File file, boolean verify) - Creates a new JarFile.
|
JarFile(File file, boolean verify, int mode) - Creates a new JarFile with the indicated mode.
|
JarFile(String fileName) - Creates a new JarFile.
|
JarFile(String fileName, boolean verify) - Creates a new JarFile.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
MANIFEST_NAME
public static final String MANIFEST_NAME
The name of the manifest entry: META-INF/MANIFEST.MF
JarFile
public JarFile(File file)
throws FileNotFoundException,
IOException
Creates a new JarFile. All jar entries are verified (when a Manifest file
for this JarFile exists). You need to actually open and read the complete
jar entry (with getInputStream()
) to check its signature.
file
- the file to open as a jar file
JarFile
public JarFile(File file,
boolean verify)
throws FileNotFoundException,
IOException
Creates a new JarFile. If verify is true then all jar entries are
verified (when a Manifest file for this JarFile exists). You need to
actually open and read the complete jar entry
(with getInputStream()
) to check its signature.
file
- the file to open to open as a jar fileverify
- checks manifest and entries when true and a manifest
exists, when false no checks are made
JarFile
public JarFile(File file,
boolean verify,
int mode)
throws FileNotFoundException,
IOException,
IllegalArgumentException
Creates a new JarFile with the indicated mode. If verify is true then
all jar entries are verified (when a Manifest file for this JarFile
exists). You need to actually open and read the complete jar entry
(with getInputStream()
) to check its signature.
manifest and if the manifest exists and verify is true verfies it.
file
- the file to open to open as a jar fileverify
- checks manifest and entries when true and a manifest
exists, when false no checks are mademode
- either ZipFile.OPEN_READ or
(ZipFile.OPEN_READ | ZipFile.OPEN_DELETE)
JarFile
public JarFile(String fileName)
throws FileNotFoundException,
IOException
Creates a new JarFile. All jar entries are verified (when a Manifest file
for this JarFile exists). You need to actually open and read the complete
jar entry (with getInputStream()
) to check its signature.
fileName
- the name of the file to open
JarFile
public JarFile(String fileName,
boolean verify)
throws FileNotFoundException,
IOException
Creates a new JarFile. If verify is true then all jar entries are
verified (when a Manifest file for this JarFile exists). You need to
actually open and read the complete jar entry
(with getInputStream()
) to check its signature.
fileName
- the name of the file to openverify
- checks manifest and entries when true and a manifest
exists, when false no checks are made
entries
public Enumeration entries()
throws IllegalStateException
Returns a enumeration of all the entries in the JarFile.
Note that also the Jar META-INF entries are returned.
getJarEntry
public JarEntry getJarEntry(String name)
Returns the JarEntry that belongs to the name if such an entry
exists in the JarFile. Returns null otherwise
Convenience method that just casts the result from getEntry
to a JarEntry.
name
- the jar entry name to look up
- the JarEntry if it exists, null otherwise
getManifest
public Manifest getManifest()
throws IOException
Returns the manifest for this JarFile or null when the JarFile does not
contain a manifest file.
JarFile.java - Representation of a jar file
Copyright (C) 2000, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.