Package proguard.io.util
Class IOUtil
- java.lang.Object
-
- proguard.io.util.IOUtil
-
public class IOUtil extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ClassPool
read(java.io.File file, boolean isLibrary)
Reads the classes from the specified jar file and returns them as a class pool.static ClassPool
read(java.io.File file, boolean isLibrary, boolean initializeKotlinMetadata)
Reads the classes from the specified jar file and returns them as a class pool.static ClassPool
read(java.io.File file, boolean isLibrary, boolean initializeKotlinMetadata, java.util.function.BiFunction<DataEntryReader,ClassVisitor,DataEntryReader> extraDataEntryReader)
Reads the classes from the specified jar file and returns them as a class pool.static ClassPool
read(java.lang.String fileName, boolean isLibrary)
Reads the classes from the specified jar file and returns them as a class pool.static ClassPool
read(java.lang.String fileName, boolean isLibrary, boolean initializeKotlinMetadata)
Reads the classes from the specified jar file and returns them as a class pool.static ClassPool
read(ClassPath classPath, java.lang.String classNameFilter, boolean android, boolean isLibrary, boolean initializeKotlinMetadata, boolean skipNonPublicLibraryClasses, boolean skipNonPublicLibraryClassMembers, boolean ignoreStackMapAttributes, java.util.function.BiFunction<DataEntryReader,ClassVisitor,DataEntryReader> extraDataEntryReader)
static ClassPool
read(ClassPath classPath, java.lang.String classNameFilter, boolean android, boolean isLibrary, boolean skipNonPublicLibraryClasses, boolean skipNonPublicLibraryClassMembers, boolean ignoreStackMapAttributes, java.util.function.BiFunction<DataEntryReader,ClassVisitor,DataEntryReader> extraDataEntryReader)
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.static void
writeJar(ClassPool programClassPool, java.lang.String outputJarFileName, java.lang.String mainClassName)
Writes the classes from the given class pool to a specified jar.
-
-
-
Method Detail
-
read
public static ClassPool read(java.lang.String fileName, boolean isLibrary) throws java.io.IOException
Reads the classes from the specified jar file and returns them as a class pool.- Parameters:
fileName
- the file name.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
-
read
public static ClassPool read(java.lang.String fileName, boolean isLibrary, boolean initializeKotlinMetadata) throws java.io.IOException
Reads the classes from the specified jar file and returns them as a class pool.- Parameters:
fileName
- the file name.isLibrary
- specifies whether classes should be represented as ProgramClass instances (for processing) or LibraryClass instances (more compact).initializeKotlinMetadata
- specifies to initialize the Kotlin metadata model.- Returns:
- a new class pool with the read classes.
- Throws:
java.io.IOException
-
read
public static ClassPool read(java.io.File file, boolean isLibrary) throws java.io.IOException
Reads the classes from the specified jar file and returns them as a class pool.- Parameters:
file
- the 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
-
read
public static ClassPool read(java.io.File file, boolean isLibrary, boolean initializeKotlinMetadata) throws java.io.IOException
Reads the classes from the specified jar file and returns them as a class pool.- Parameters:
file
- the file.isLibrary
- specifies whether classes should be represented as ProgramClass instances (for processing) or LibraryClass instances (more compact).initializeKotlinMetadata
- specifies to initialize the Kotlin metadata model.- Returns:
- a new class pool with the read classes.
- Throws:
java.io.IOException
-
read
public static ClassPool read(java.io.File file, boolean isLibrary, boolean initializeKotlinMetadata, java.util.function.BiFunction<DataEntryReader,ClassVisitor,DataEntryReader> extraDataEntryReader) throws java.io.IOException
Reads the classes from the specified jar file and returns them as a class pool.- Parameters:
file
- the name of the file.isLibrary
- specifies whether classes should be represented as ProgramClass instances (for processing) or LibraryClass instances (more compact).initializeKotlinMetadata
- specifies to initialize the Kotlin metadata model.extraDataEntryReader
- Optionally provide a function that wraps the reader in another reader.- Returns:
- a new class pool with the read classes.
- Throws:
java.io.IOException
-
read
public static ClassPool read(ClassPath classPath, java.lang.String classNameFilter, boolean android, boolean isLibrary, boolean skipNonPublicLibraryClasses, boolean skipNonPublicLibraryClassMembers, boolean ignoreStackMapAttributes, java.util.function.BiFunction<DataEntryReader,ClassVisitor,DataEntryReader> extraDataEntryReader) throws java.io.IOException
Reads the classes from the specified jar file and returns them as a class pool.- Parameters:
isLibrary
- specifies whether classes should be represented as ProgramClass instances (for processing) or LibraryClass instances (more compact).extraDataEntryReader
- Optionally provide a function that wraps the reader in another reader.- Returns:
- a new class pool with the read classes.
- Throws:
java.io.IOException
-
read
public static ClassPool read(ClassPath classPath, java.lang.String classNameFilter, boolean android, boolean isLibrary, boolean initializeKotlinMetadata, boolean skipNonPublicLibraryClasses, boolean skipNonPublicLibraryClassMembers, boolean ignoreStackMapAttributes, java.util.function.BiFunction<DataEntryReader,ClassVisitor,DataEntryReader> extraDataEntryReader) throws java.io.IOException
- 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
-
writeJar
public static void writeJar(ClassPool programClassPool, java.lang.String outputJarFileName, java.lang.String mainClassName) 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
-
-