public class ClassFileSourceImpl extends java.lang.Object implements ClassFileSource2
Modifier and Type | Class and Description |
---|---|
private static class |
ClassFileSourceImpl.JarSourceEntry |
ClassFileSource.Factory
Modifier and Type | Field and Description |
---|---|
private ClassFileRelocator |
classRelocator |
private ClassRenamer |
classRenamer |
private java.util.Map<java.lang.String,ClassFileSourceImpl.JarSourceEntry> |
classToPathMap |
private java.util.Set<java.lang.String> |
explicitJars |
private static boolean |
JrtPresent |
private Options |
options |
private static java.util.Map<java.lang.String,java.lang.String> |
packMap |
Constructor and Description |
---|
ClassFileSourceImpl(Options options) |
Modifier and Type | Method and Description |
---|---|
java.util.Collection<java.lang.String> |
addJar(java.lang.String jarPath)
Deprecated.
|
JarContent |
addJarContent(java.lang.String jarPath,
AnalysisType analysisType)
CFR would like to know about all classes contained within the jar at
jarPath |
private static boolean |
CheckJrt() |
private byte[] |
getBytesFromFile(java.io.InputStream is,
long length) |
Pair<byte[],java.lang.String> |
getClassFileContent(java.lang.String inputPath)
Given a path to a class file, return a pair of
* the content, as a byte array.
|
private java.util.Map<java.lang.String,ClassFileSourceImpl.JarSourceEntry> |
getClassPathClasses() |
private byte[] |
getContentByFromReflectedClass(java.lang.String inputPath) |
private byte[] |
getInternalContent(java.lang.String inputPath) |
private java.util.Map<java.lang.String,java.lang.String> |
getManifestContent(java.util.zip.ZipFile zipFile) |
private static java.util.Map<java.lang.String,java.lang.String> |
getPackageToModuleMap() |
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.
|
private byte[] |
getUrlContent(java.net.URL url) |
void |
informAnalysisRelativePathDetail(java.lang.String usePath,
java.lang.String specPath)
CFR has loaded your class, and it has decided that if it were in the correct location, it would instead
be at
classFilePath . |
private JarContent |
processClassPathFile(java.io.File file,
boolean dump,
AnalysisType analysisType) |
private void |
processClassPathFile(java.io.File file,
java.lang.String absolutePath,
java.util.Map<java.lang.String,ClassFileSourceImpl.JarSourceEntry> classToPathMap,
AnalysisType analysisType,
boolean dump) |
private final java.util.Set<java.lang.String> explicitJars
private java.util.Map<java.lang.String,ClassFileSourceImpl.JarSourceEntry> classToPathMap
private final Options options
private ClassRenamer classRenamer
private ClassFileRelocator classRelocator
private static final boolean JrtPresent
private static final java.util.Map<java.lang.String,java.lang.String> packMap
public ClassFileSourceImpl(Options options)
private static boolean CheckJrt()
private byte[] getBytesFromFile(java.io.InputStream is, long length) throws java.io.IOException
java.io.IOException
public java.lang.String getPossiblyRenamedPath(java.lang.String path)
ClassFileSource
getPossiblyRenamedPath
in interface ClassFileSource
path
- Path CFR would like to usepublic Pair<byte[],java.lang.String> getClassFileContent(java.lang.String inputPath) throws java.io.IOException
ClassFileSource
getClassFileContent
in interface ClassFileSource
inputPath
- relative path of class we wish to load.java.io.IOException
- if you can't find the class.private static java.util.Map<java.lang.String,java.lang.String> getPackageToModuleMap()
private byte[] getContentByFromReflectedClass(java.lang.String inputPath)
private byte[] getUrlContent(java.net.URL url)
private byte[] getInternalContent(java.lang.String inputPath) throws java.io.IOException
java.io.IOException
@Deprecated public java.util.Collection<java.lang.String> addJar(java.lang.String jarPath)
ClassFileSource
jarPath
addJar
in interface ClassFileSource
jarPath
- path to a jar.public JarContent addJarContent(java.lang.String jarPath, AnalysisType analysisType)
ClassFileSource2
jarPath
addJarContent
in interface ClassFileSource2
jarPath
- path to a jar.private java.util.Map<java.lang.String,ClassFileSourceImpl.JarSourceEntry> getClassPathClasses()
private void processClassPathFile(java.io.File file, java.lang.String absolutePath, java.util.Map<java.lang.String,ClassFileSourceImpl.JarSourceEntry> classToPathMap, AnalysisType analysisType, boolean dump)
private JarContent processClassPathFile(java.io.File file, boolean dump, AnalysisType analysisType)
private java.util.Map<java.lang.String,java.lang.String> getManifestContent(java.util.zip.ZipFile zipFile)
public void informAnalysisRelativePathDetail(java.lang.String usePath, java.lang.String specPath)
ClassFileSource
classFilePath
.
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.informAnalysisRelativePathDetail
in interface ClassFileSource
usePath
- the path that was used to load a class file.specPath
- the path that CFR actually suspects it should have been, based on package name.