Package proguard.examples
Class JarUtil
java.lang.Object
proguard.examples.JarUtil
This utility class provides methods to read and write the classes in jars.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ClassPoolReads the classes from the specified jar file and returns them as a class pool.static ClassPoolReads the classes from the specified jar file and returns them as a class pool.static voidWrites the classes from the given class pool to a specified jar.
-
Constructor Details
-
JarUtil
public JarUtil()
-
-
Method Details
-
readJar
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:
IOException
-
readJar
public static ClassPool readJar(String jarFileName, String classNameFilter, boolean isLibrary) throws 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:
IOException
-
writeJar
public static void writeJar(ClassPool programClassPool, String outputJarFileName) throws 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:
IOException
-