Package org.benf.cfr.reader.state
Class ClassFileSourceChained
- java.lang.Object
-
- org.benf.cfr.reader.state.ClassFileSourceChained
-
- All Implemented Interfaces:
ClassFileSource
,ClassFileSource2
public class ClassFileSourceChained extends java.lang.Object implements ClassFileSource2
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.benf.cfr.reader.api.ClassFileSource
ClassFileSource.Factory
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<ClassFileSource2>
sources
-
Constructor Summary
Constructors Constructor Description ClassFileSourceChained(java.util.Collection<ClassFileSource2> sources)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<java.lang.String>
addJar(java.lang.String jarPath)
CFR would like to know about all classes contained within the jar atjarPath
JarContent
addJarContent(java.lang.String jarPath, AnalysisType analysisType)
CFR would like to know about all classes contained within the jar atjarPath
Pair<byte[],java.lang.String>
getClassFileContent(java.lang.String path)
Given a path to a class file, return a pair of * the content, as a byte array.java.lang.String
getPossiblyRenamedPath(java.lang.String path)
It's possible that an obfuscator might have generated a bizarre and magic file inside a jar such that it's path is too big to read.void
informAnalysisRelativePathDetail(java.lang.String usePath, java.lang.String classFilePath)
CFR has loaded your class, and it has decided that if it were in the correct location, it would instead be atclassFilePath
.
-
-
-
Field Detail
-
sources
private final java.util.Collection<ClassFileSource2> sources
-
-
Constructor Detail
-
ClassFileSourceChained
public ClassFileSourceChained(java.util.Collection<ClassFileSource2> sources)
-
-
Method Detail
-
addJarContent
public JarContent addJarContent(java.lang.String jarPath, AnalysisType analysisType)
Description copied from interface:ClassFileSource2
CFR would like to know about all classes contained within the jar atjarPath
- Specified by:
addJarContent
in interfaceClassFileSource2
- Parameters:
jarPath
- path to a jar.- Returns:
-
informAnalysisRelativePathDetail
public void informAnalysisRelativePathDetail(java.lang.String usePath, java.lang.String classFilePath)
Description copied from interface:ClassFileSource
CFR has loaded your class, and it has decided that if it were in the correct location, it would instead be atclassFilePath
. This information should be taken into account when loading any inner classes, or other classes that CFR tries to load in order to improve decompilation. Why do you care? Let's say you have a class in a top level outside its normal structure, Bob.class. It should be found at org/person/Bob.class. Implementors of this will be called back with "", and "org/person", telling you that org.person are implicit in your path. CFR may later ask you to load "org/person/Bob$1.class". You should adjust this path to match where Bob$1 actually is. This will also be called with null, null to reset.- Specified by:
informAnalysisRelativePathDetail
in interfaceClassFileSource
- Parameters:
usePath
- the path that was used to load a class file.classFilePath
- the path that CFR actually suspects it should have been, based on package name.
-
addJar
public java.util.Collection<java.lang.String> addJar(java.lang.String jarPath)
Description copied from interface:ClassFileSource
CFR would like to know about all classes contained within the jar atjarPath
- Specified by:
addJar
in interfaceClassFileSource
- Parameters:
jarPath
- path to a jar.- Returns:
- paths (inside jar) of all classes.
-
getPossiblyRenamedPath
public java.lang.String getPossiblyRenamedPath(java.lang.String path)
Description copied from interface:ClassFileSource
It's possible that an obfuscator might have generated a bizarre and magic file inside a jar such that it's path is too big to read. Or it's invalid. This allows you to remap paths.- Specified by:
getPossiblyRenamedPath
in interfaceClassFileSource
- Parameters:
path
- Path CFR would like to use- Returns:
- Remapped path.
-
getClassFileContent
public Pair<byte[],java.lang.String> getClassFileContent(java.lang.String path) throws java.io.IOException
Description copied from interface:ClassFileSource
Given a path to a class file, return a pair of * the content, as a byte array. * the path where you found this.- Specified by:
getClassFileContent
in interfaceClassFileSource
- Parameters:
path
- relative path of class we wish to load.- Returns:
- Pair<byte[], String> of class file content, and file location.
- Throws:
java.io.IOException
- if you can't find the class.
-
-