Package proguard.examples
Class JarUtil
- java.lang.Object
-
- proguard.examples.JarUtil
-
public class JarUtil extends java.lang.Object
This utility class provides methods to read and write the classes in jars.
-
-
Constructor Summary
Constructors Constructor Description JarUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ClassPool
readJar(java.lang.String jarFileName, boolean isLibrary)
Reads the classes from the specified jar file and returns them as a class pool.static ClassPool
readJar(java.lang.String jarFileName, java.lang.String classNameFilter, boolean isLibrary)
Reads the classes from the specified jar file and returns them as a class pool.static void
writeJar(ClassPool programClassPool, java.lang.String outputJarFileName)
Writes the classes from the given class pool to a specified jar.
-
-
-
Method Detail
-
readJar
public static ClassPool readJar(java.lang.String jarFileName, boolean isLibrary) throws java.io.IOException
Reads the classes from the specified jar file and returns them as a class pool.- Parameters:
jarFileName
- the name of the jar file or jmod file.isLibrary
- specifies whether classes should be represented as ProgramClass instances (for processing) or LibraryClass instances (more compact).- Returns:
- a new class pool with the read classes.
- Throws:
java.io.IOException
-
readJar
public static ClassPool readJar(java.lang.String jarFileName, java.lang.String classNameFilter, boolean isLibrary) throws java.io.IOException
Reads the classes from the specified jar file and returns them as a class pool.- Parameters:
jarFileName
- the name of the jar file or jmod file.isLibrary
- specifies whether classes should be represented as ProgramClass instances (for processing) or LibraryClass instances (more compact).- Returns:
- a new class pool with the read classes.
- Throws:
java.io.IOException
-
writeJar
public static void writeJar(ClassPool programClassPool, java.lang.String outputJarFileName) throws java.io.IOException
Writes the classes from the given class pool to a specified jar.- Parameters:
programClassPool
- the classes to write.outputJarFileName
- the name of the output jar file.- Throws:
java.io.IOException
-
-