public class JarFile
extends java.lang.Object
implements org.cadixdev.bombe.asm.jar.ClassProvider, java.io.Closeable
| Constructor and Description |
|---|
JarFile(java.nio.file.Path path) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
org.cadixdev.bombe.jar.AbstractJarEntry |
get(JarPath path)
Gets the entry for the given
JAR path. |
byte[] |
get(java.lang.String klass) |
org.cadixdev.bombe.jar.JarClassEntry |
getClass(JarPath path)
Gets the cached class entry, of the given
JAR path. |
org.cadixdev.bombe.jar.JarClassEntry |
getClass(java.lang.String name)
Gets the cached class entry, of the given name.
|
java.lang.String |
getName()
Gets the name (location on file system) of the JAR file.
|
void |
transform(java.nio.file.Path export,
org.cadixdev.bombe.jar.JarEntryTransformer... transformers)
Transforms the JAR file, with the given
JarEntryTransformers, writing
to the given output JAR path. |
java.util.stream.Stream<JarPath> |
walk(JarVisitOption... options)
Walks through the jar entries within the JAR file, omitting those targeted
by a
JarVisitOption. |
public JarFile(java.nio.file.Path path)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getName()
public org.cadixdev.bombe.jar.AbstractJarEntry get(JarPath path) throws java.io.IOException
JAR path.
Class entries will be cached upon use.
path - The path of the entrynull if no entry for the path existsjava.io.IOException - Should an issue occur reading the entrypublic org.cadixdev.bombe.jar.JarClassEntry getClass(JarPath path)
JAR path.path - The class's JAR entry pathnull if not presentpublic org.cadixdev.bombe.jar.JarClassEntry getClass(java.lang.String name)
name - The class namenull if not presentpublic java.util.stream.Stream<JarPath> walk(JarVisitOption... options) throws java.io.IOException
JarVisitOption.options - The visit options to use, while walkingjava.io.IOException - Should an issue with reading occurpublic void transform(java.nio.file.Path export,
org.cadixdev.bombe.jar.JarEntryTransformer... transformers)
throws java.io.IOException
JarEntryTransformers, writing
to the given output JAR path.export - The JAR path to write totransformers - The transformers to usejava.io.IOException - Should an issue with reading or writing occurpublic byte[] get(java.lang.String klass)
get in interface org.cadixdev.bombe.asm.jar.ClassProviderpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOException