public class Jar
extends java.lang.Object
implements java.io.Closeable
JarFiles enabling quick access to the
jar's main class, as well as the ability to get the InputStream of a
class file, and speedy lookups to see if the jar contains the specified
class.| Constructor and Description |
|---|
Jar() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes all jar files in this Jar
|
boolean |
containsClass(java.lang.String clazz)
Check if this jar contains the given class.
|
boolean |
containsResource(java.lang.String name)
Check if this jar contains the given resource.
|
java.io.InputStream |
getClass(java.lang.String clazz)
Takes the internal name of a class (/).
|
java.util.Set<java.lang.String> |
getEntryNames()
Get all file names in the jar, (archive order is preserved).
|
org.objectweb.asm.tree.ClassNode |
getNode(java.lang.String clazz)
Get the
ClassNode object corresponding to this class. |
java.io.InputStream |
getResource(java.lang.String name)
Get the stream for a file in this jar.
|
static Jar |
init(java.io.File file)
Read a new jar instance from the given file.
|
static Jar |
init(java.util.List<java.io.File> files)
Read a new jar instance from the given list of files.
|
public boolean containsClass(java.lang.String clazz)
clazz - public boolean containsResource(java.lang.String name)
name - The name of the resourcepublic java.io.InputStream getResource(java.lang.String name)
throws java.io.IOException
name - java.io.IOExceptionpublic java.io.InputStream getClass(java.lang.String clazz)
throws java.io.IOException
clazz - java.io.IOExceptionpublic org.objectweb.asm.tree.ClassNode getNode(java.lang.String clazz)
ClassNode object corresponding to this class. Takes the
internal name of a class (/)clazz - public java.util.Set<java.lang.String> getEntryNames()
public static Jar init(java.io.File file) throws java.io.IOException
file - java.io.IOExceptionpublic static Jar init(java.util.List<java.io.File> files) throws java.io.IOException
files - java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOException - if an I/O error has occurredCloseableCopyright © 2012-2021. All Rights Reserved.