public class XJarFile extends JarFile implements IJarFile
Modifier and Type | Field and Description |
---|---|
static int |
CENATT |
static int |
CENATX |
static int |
CENCOM |
static int |
CENCRC |
static int |
CENDSK |
static int |
CENEXT |
static int |
CENFLG |
static int |
CENHDR |
static int |
CENHOW |
static int |
CENLEN |
static int |
CENNAM |
static int |
CENOFF |
static long |
CENSIG |
static int |
CENSIZ |
static int |
CENTIM |
static int |
CENVEM |
static int |
CENVER |
static int |
ENDCOM |
static int |
ENDHDR |
static int |
ENDOFF |
static long |
ENDSIG |
static int |
ENDSIZ |
static int |
ENDSUB |
static int |
ENDTOT |
static int |
EXTCRC |
static int |
EXTHDR |
static int |
EXTLEN |
static long |
EXTSIG |
static int |
EXTSIZ |
static int |
LOCCRC |
static int |
LOCEXT |
static int |
LOCFLG |
static int |
LOCHDR |
static int |
LOCHOW |
static int |
LOCLEN |
static int |
LOCNAM |
static long |
LOCSIG |
static int |
LOCSIZ |
static int |
LOCTIM |
static int |
LOCVER |
MANIFEST_NAME
OPEN_DELETE, OPEN_READ
Constructor and Description |
---|
XJarFile(File file)
Loads or opens the JAR file "inMemory", without "winStyle" and "verify".
|
XJarFile(File file,
boolean inMemory,
boolean winStyle,
boolean verify)
Loads or opens the JAR file.
|
XJarFile(String name)
Loads or opens the JAR file "inMemory", without "winStyle", but with "verify".
|
XJarFile(String name,
boolean inMemory,
boolean winStyle,
boolean verify)
Loads or opens the JAR file.
|
Modifier and Type | Method and Description |
---|---|
static void |
clearLoadedFilesList()
Clears the loaded files list.
|
void |
close()
Closes the ZIP file.
|
Enumeration<JarEntry> |
entries()
Returns an enumeration of the zip file entries.
|
ZipEntry |
getEntry(String name)
Gets the ZIP entry with the specified name.
|
byte[] |
getEntryData(String name)
Gets the byte [] data for an entry if present.
|
byte[] |
getEntryData(ZipEntry ze)
Gets the byte [] data for an entry if present.
|
Handler |
getHandler()
Gets the URL stream handler for the MemoryJarFile.
|
InputStream |
getInputStream(ZipEntry ze)
Returns an input stream for reading the contents of the specified zip file entry.
|
JarEntry[] |
getJarEntries()
Gets all Jar entries if the Jar file is loaded into memory.
|
JarEntry |
getJarEntry(String name)
Gets the JAR entry with the specified name.
|
File |
getJarFile()
Gets the file of the Jar file.
|
static XJarFile |
getJarFile(File file)
Loads the requested XJarFile or grabs one from the table of loaded files and reloads
it as required.
|
static XJarFile |
getJarFile(String fileName)
Loads the requested XJarFile or grabs one from the table of loaded files and reloads
it as required.
|
Manifest |
getManifest()
Returns the jar file manifest, or
null if none. |
URL |
getURL()
Gets the XJar URL to be used with e.g.
|
URL |
getURL(String path)
Gets the XJar URL to be used with e.g.
|
URL |
getURL(ZipEntry entry)
Gets the XJar URL to be used with e.g.
|
boolean |
hasChanged()
Checks if the Jar file has changed since last call to this method,
i.e.
|
int |
size()
Returns the number of entries in the Jar file.
|
finalize, getComment, getName
public static final long LOCSIG
public static final long EXTSIG
public static final long CENSIG
public static final long ENDSIG
public static final int LOCHDR
public static final int EXTHDR
public static final int CENHDR
public static final int ENDHDR
public static final int LOCVER
public static final int LOCFLG
public static final int LOCHOW
public static final int LOCTIM
public static final int LOCCRC
public static final int LOCSIZ
public static final int LOCLEN
public static final int LOCNAM
public static final int LOCEXT
public static final int EXTCRC
public static final int EXTSIZ
public static final int EXTLEN
public static final int CENVEM
public static final int CENVER
public static final int CENFLG
public static final int CENHOW
public static final int CENTIM
public static final int CENCRC
public static final int CENSIZ
public static final int CENLEN
public static final int CENNAM
public static final int CENEXT
public static final int CENCOM
public static final int CENDSK
public static final int CENATT
public static final int CENATX
public static final int CENOFF
public static final int ENDSUB
public static final int ENDTOT
public static final int ENDSIZ
public static final int ENDOFF
public static final int ENDCOM
public XJarFile(String name) throws IOException
name
- the file name.IOException
- for file failures.public XJarFile(File file) throws IOException
file
- the file.IOException
- for file failures.public XJarFile(String name, boolean inMemory, boolean winStyle, boolean verify) throws IOException
name
- the file name.inMemory
- if true, the entire Jar file is loaded into memory and then closed. Subsequent operations can be
performed as normal.winStyle
- if true, the entries are case insensitive and backslash can be used with forward slash as well.verify
- if the Jar file should be verified.IOException
- for file failures.public XJarFile(File file, boolean inMemory, boolean winStyle, boolean verify) throws IOException
file
- the file.inMemory
- if true, the entire Jar file is loaded into memory and then closed. Subsequent operations can be
performed as normal.winStyle
- if true, the entries are case insensitive and backslash can be used with forward slash as well.verify
- if the Jar file should be verified.IOException
- for file failures.public static void clearLoadedFilesList()
public static XJarFile getJarFile(String fileName) throws IOException
IOException
- for file failures.public static XJarFile getJarFile(File file) throws IOException
IOException
- for file failures.public File getJarFile()
public Handler getHandler()
getHandler
in interface IJarFile
public URL getURL()
public boolean hasChanged()
public Enumeration<JarEntry> entries()
public JarEntry[] getJarEntries()
getJarEntries
in interface IJarFile
public InputStream getInputStream(ZipEntry ze) throws IOException
getInputStream
in class JarFile
ZipException
- if a zip file format error has occurred.IOException
- if an I/O error has occurred.SecurityException
- if any of the jar file entries are incorrectly signed.IllegalStateException
- may be thrown if the jar file has been closed.public JarEntry getJarEntry(String name)
getJarEntry
in class JarFile
public int size()
size
in class ZipFile
IllegalStateException
- if the Jar file has been closed.public Manifest getManifest() throws IOException
null
if none.getManifest
in class JarFile
null
if none.IllegalStateException
- may be thrown if the jar file has been closedIOException
public byte[] getEntryData(String name)
getEntryData
in interface IJarFile
name
- the name of the entry.public byte[] getEntryData(ZipEntry ze)
getEntryData
in interface IJarFile
ze
- the name of the entry.public void close() throws IOException
Closing this ZIP file will close all of the input streams
previously returned by invocations of the getInputStream
method.
close
in interface Closeable
close
in interface AutoCloseable
close
in class ZipFile
IOException
- if an I/O error has occurrediizi® is a registered trademark of Mindus SARL. © Copyright 2019 Mindus SARL. All rights reserved.