|
ProGuard | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectproguard.classfile.util.ClassUtil
Utility methods for converting between internal and external representations of names and descriptions.
| Constructor Summary | |
ClassUtil()
|
|
| Method Summary | |
static void |
checkMagicNumber(int magicNumber)
Checks whether the given class file magic number is correct. |
static void |
checkVersionNumbers(int majorVersionNumber,
int minorVersionNumber)
Checks whether the given class file version numbers are supported. |
static int |
externalArrayTypeDimensionCount(String externalType)
Returns the number of dimensions of the given external type. |
static String |
externalClassAccessFlags(int accessFlags)
Converts internal class access flags into an external access description. |
static String |
externalClassAccessFlags(int accessFlags,
String prefix)
Converts internal class access flags into an external access description. |
static String |
externalClassName(String internalClassName)
Converts an internal class name into an external class name. |
static String |
externalFieldAccessFlags(int accessFlags)
Converts internal field access flags into an external access description. |
static String |
externalFieldAccessFlags(int accessFlags,
String prefix)
Converts internal field access flags into an external access description. |
static String |
externalFullClassDescription(int accessFlags,
String internalClassName)
Converts an internal class description into an external class description. |
static String |
externalFullFieldDescription(int accessFlags,
String fieldName,
String internalFieldDescriptor)
Converts an internal field description into an external full field description. |
static String |
externalFullMethodDescription(String internalClassName,
int accessFlags,
String internalMethodName,
String internalMethodDescriptor)
Converts an internal method description into an external full method description. |
static String |
externalMethodAccessFlags(int accessFlags)
Converts internal method access flags into an external access description. |
static String |
externalMethodAccessFlags(int accessFlags,
String prefix)
Converts internal method access flags into an external access description. |
static String |
externalMethodArguments(String internalMethodDescriptor)
Converts an internal method descriptor into an external method argument description. |
static String |
externalMethodName(String externalMethodNameAndArguments)
Returns the name part of the given external method name and arguments. |
static String |
externalMethodReturnType(String internalMethodDescriptor)
Converts an internal method descriptor into an external method return type. |
static String |
externalPackageName(String externalClassName)
Returns the external package name of the given external class name. |
static String |
externalShortClassName(String externalClassName)
Converts an internal class name into an external short class name, without package specification. |
static String |
externalType(String internalType)
Converts an internal type into an external type. |
static int |
internalArrayTypeDimensionCount(String internalType)
Returns the number of dimensions of the given internal type. |
static String |
internalClassName(String externalClassName)
Converts an external class name into an internal class name. |
static String |
internalClassNameFromClassType(String internalClassType)
Returns the internal class name of a given internal class type. |
static String |
internalClassNameFromType(String internalClassType)
Returns the internal class name of any given internal type. |
static String |
internalMethodDescriptor(String externalReturnType,
List externalArguments)
Converts the given external method return type and List of arguments to an internal method descriptor. |
static String |
internalMethodDescriptor(String externalReturnType,
String externalMethodNameAndArguments)
Converts the given external method return type and name and arguments to an internal method descriptor. |
static int |
internalMethodParameterCount(String internalMethodDescriptor)
Returns the number of parameters of the given internal method descriptor. |
static int |
internalMethodParameterSize(String internalMethodDescriptor)
Returns the size taken up on the stack by the parameters of the given internal method descriptor. |
static String |
internalMethodReturnType(String internalMethodDescriptor)
Returns the internal type of the given internal method descriptor. |
static String |
internalPackageName(String internalClassName)
Returns the internal package name of the given internal class name. |
static String |
internalType(String externalType)
Converts an external type into an internal type. |
static String |
internalTypeFromArrayType(String internalArrayType)
Returns the internal element type of a given internal array type. |
static int |
internalTypeSize(String internalType)
Returns the size taken up on the stack by the given internal type. |
static boolean |
isExternalMethodNameAndArguments(String externalMemberNameAndArguments)
Returns whether the given member String represents an external method name with arguments. |
static boolean |
isInternalArrayType(String internalType)
Returns whether the given internal type is an array type. |
static boolean |
isInternalClassType(String internalType)
Returns whether the given internal type is a plain class type (not an array type). |
static boolean |
isInternalMethodDescriptor(String internalDescriptor)
Returns whether the given internal descriptor String represents a method descriptor. |
static boolean |
isInternalPrimitiveType(char internalType)
Returns whether the given internal type is a plain primitive type (not void). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ClassUtil()
| Method Detail |
public static void checkMagicNumber(int magicNumber)
throws IOException
magicNumber - the magic number.
IOException - when the magic number is incorrect.
public static void checkVersionNumbers(int majorVersionNumber,
int minorVersionNumber)
throws IOException
majorVersionNumber - the major version number.minorVersionNumber - the minor version number.
IOException - when the version is not supported.public static String internalClassName(String externalClassName)
externalClassName - the external class name,
e.g. "java.lang.Object"
java/lang/Object".
public static String externalFullClassDescription(int accessFlags,
String internalClassName)
accessFlags - the access flags of the class.internalClassName - the internal class name,
e.g. "java/lang/Object".
public java.lang.Object".public static String externalClassName(String internalClassName)
internalClassName - the internal class name,
e.g. "java/lang/Object".
java.lang.Object".public static String externalShortClassName(String externalClassName)
externalClassName - the external class name,
e.g. "java.lang.Object"
Object".public static boolean isInternalArrayType(String internalType)
internalType - the internal type,
e.g. "[[Ljava/lang/Object;".
true if the given type is an array type,
false otherwise.public static int internalArrayTypeDimensionCount(String internalType)
internalType - the internal type,
e.g. "[[Ljava/lang/Object;".
public static boolean isInternalPrimitiveType(char internalType)
internalType - the internal type,
e.g. "I".
true if the given type is a class type,
false otherwise.public static boolean isInternalClassType(String internalType)
internalType - the internal type,
e.g. "Ljava/lang/Object;".
true if the given type is a class type,
false otherwise.public static String internalTypeFromArrayType(String internalArrayType)
internalArrayType - the internal array type,
e.g. "[[Ljava/lang/Object;" or
"[I".
Ljava/lang/Object;" or
"I".public static String internalClassNameFromClassType(String internalClassType)
internalClassType - the internal class type,
e.g. "Ljava/lang/Object;".
java/lang/Object".public static String internalClassNameFromType(String internalClassType)
java/lang/Object".
internalClassType - the internal class type,
e.g. "Ljava/lang/Object;" or
"[[I".
java/lang/Object".public static String internalMethodReturnType(String internalMethodDescriptor)
internalMethodDescriptor - the internal method descriptor,
e.g. "(II)Z".
Z".public static int internalMethodParameterCount(String internalMethodDescriptor)
internalMethodDescriptor - the internal method descriptor,
e.g. "(ID)Z".
public static int internalMethodParameterSize(String internalMethodDescriptor)
internalMethodDescriptor - the internal method descriptor,
e.g. "(ID)Z".
public static int internalTypeSize(String internalType)
internalType - the internal type,
e.g. "I".
public static String internalType(String externalType)
externalType - the external type,
e.g. "java.lang.Object[][]" or
"int[]".
[[Ljava/lang/Object;" or
"[I".public static int externalArrayTypeDimensionCount(String externalType)
externalType - the external type,
e.g. "[[Ljava/lang/Object;".
public static String externalType(String internalType)
internalType - the internal type,
e.g. "[[Ljava/lang/Object;" or
"[I".
java.lang.Object[][]" or
"int[]".public static boolean isInternalMethodDescriptor(String internalDescriptor)
internalDescriptor - the internal descriptor String,
e.g. "(II)Z".
true if the given String is a method descriptor,
false otherwise.public static boolean isExternalMethodNameAndArguments(String externalMemberNameAndArguments)
externalMemberNameAndArguments - the external member String,
e.g. "myField" or
e.g. "myMethod(int,int)".
true if the given String refers to a method,
false otherwise.public static String externalMethodName(String externalMethodNameAndArguments)
externalMethodNameAndArguments - the external method name and arguments,
e.g. "myMethod(int,int)".
myMethod".
public static String internalMethodDescriptor(String externalReturnType,
String externalMethodNameAndArguments)
externalReturnType - the external method return type,
e.g. "boolean".externalMethodNameAndArguments - the external method name and arguments,
e.g. "myMethod(int,int)".
(II)Z".
public static String internalMethodDescriptor(String externalReturnType,
List externalArguments)
externalReturnType - the external method return type,
e.g. "boolean".externalArguments - the external method arguments,
e.g. { "int", "int" }.
(II)Z".
public static String externalFullFieldDescription(int accessFlags,
String fieldName,
String internalFieldDescriptor)
accessFlags - the access flags of the field.fieldName - the field name,
e.g. "myField".internalFieldDescriptor - the internal field descriptor,
e.g. "Z".
public boolean myField".
public static String externalFullMethodDescription(String internalClassName,
int accessFlags,
String internalMethodName,
String internalMethodDescriptor)
internalClassName - the internal name of the class of the method,
e.g. "mypackage/MyClass".accessFlags - the access flags of the method.internalMethodName - the internal method name,
e.g. "myMethod" or
"<init>".internalMethodDescriptor - the internal method descriptor,
e.g. "(II)Z".
public boolean myMethod(int,int)" or
"public MyClass(int,int)".public static String externalClassAccessFlags(int accessFlags)
accessFlags - the class access flags.
public final ".
public static String externalClassAccessFlags(int accessFlags,
String prefix)
accessFlags - the class access flags.prefix - a prefix that is added to each access modifier.
public final ".public static String externalFieldAccessFlags(int accessFlags)
accessFlags - the field access flags.
public volatile ".
public static String externalFieldAccessFlags(int accessFlags,
String prefix)
accessFlags - the field access flags.prefix - a prefix that is added to each access modifier.
public volatile ".public static String externalMethodAccessFlags(int accessFlags)
accessFlags - the method access flags.
public synchronized ".
public static String externalMethodAccessFlags(int accessFlags,
String prefix)
accessFlags - the method access flags.prefix - a prefix that is added to each access modifier.
public static String externalMethodReturnType(String internalMethodDescriptor)
internalMethodDescriptor - the internal method descriptor,
e.g. "(II)Z".
boolean".public static String externalMethodArguments(String internalMethodDescriptor)
internalMethodDescriptor - the internal method descriptor,
e.g. "(II)Z".
int,int".public static String internalPackageName(String internalClassName)
internalClassName - the internal class name,
e.g. "java/lang/Object".
java/lang".public static String externalPackageName(String externalClassName)
externalClassName - the external class name,
e.g. "java.lang.Object".
java.lang".
|
ProGuard | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||