org.apache.bcel.classfile
public abstract class Utility extends Object
Method Summary | |
---|---|
static String | accessToString(int access_flags)
Convert bit field of flags into string such as `static final'.
|
static String | accessToString(int access_flags, boolean for_class)
Convert bit field of flags into string such as `static final'.
|
static String | classOrInterface(int access_flags) |
static int | clearBit(int flag, int i) |
static String | codeToString(byte[] code, ConstantPool constant_pool, int index, int length, boolean verbose)
Disassemble a byte array of JVM byte codes starting from code line
`index' and return the disassembled string representation. |
static String | codeToString(byte[] code, ConstantPool constant_pool, int index, int length) |
static String | codeToString(ByteSequence bytes, ConstantPool constant_pool, boolean verbose)
Disassemble a stream of byte codes and return the
string representation.
|
static String | codeToString(ByteSequence bytes, ConstantPool constant_pool) |
static String | compactClassName(String str)
Shorten long class names, java/lang/String becomes
String.
|
static String | compactClassName(String str, String prefix, boolean chopit)
Shorten long class name str, i.e., chop off the prefix,
if the
class name starts with this string and the flag chopit is true.
|
static String | compactClassName(String str, boolean chopit)
Shorten long class names, java/lang/String becomes
java.lang.String,
e.g.. |
static String | convertString(String label)
Escape all occurences of newline chars '\n', quotes \", etc. |
static byte[] | decode(String s, boolean uncompress) Decode a string back to a byte array.
|
static String | encode(byte[] bytes, boolean compress) Encode byte array it into Java identifier string, i.e., a string
that only contains the following characters: (a, ... z, A, ... |
static String | fillup(String str, int length, boolean left_justify, char fill)
Fillup char with up to length characters with char `fill' and justify it left or right.
|
static String | format(int i, int length, boolean left_justify, char fill)
Return a string for an integer justified left or right and filled up with
`fill' characters if necessary.
|
static String | getSignature(String type) Parse Java type such as "char", or "java.lang.String[]" and return the
signature in byte code format, e.g. |
static boolean | isJavaIdentifierPart(char ch) |
static boolean | isSet(int flag, int i) |
static String[] | methodSignatureArgumentTypes(String signature) |
static String[] | methodSignatureArgumentTypes(String signature, boolean chopit) |
static String | methodSignatureReturnType(String signature) |
static String | methodSignatureReturnType(String signature, boolean chopit) |
static String | methodSignatureToString(String signature, String name, String access)
Converts method signature to string with all class names compacted.
|
static String | methodSignatureToString(String signature, String name, String access, boolean chopit) |
static String | methodSignatureToString(String signature, String name, String access, boolean chopit, LocalVariableTable vars)
A returntype signature represents the return value from a method.
|
static String | methodTypeToSignature(String ret, String[] argv)
Converts string containing the method return and argument types
to a byte code method signature.
|
static void | printArray(PrintStream out, Object[] obj) |
static void | printArray(PrintWriter out, Object[] obj) |
static String | printArray(Object[] obj) |
static String | printArray(Object[] obj, boolean braces) |
static String | printArray(Object[] obj, boolean braces, boolean quote) |
static String | replace(String str, String old, String new_)
Replace all occurences of old in str with new.
|
static short | searchOpcode(String name) Map opcode names to opcode numbers. |
static int | setBit(int flag, int i) |
static String | signatureToString(String signature)
Converts signature to string with all class names compacted.
|
static String | signatureToString(String signature, boolean chopit)
The field signature represents the value of an argument to a function or
the value of a variable. |
static String | toHexString(byte[] bytes) Convert bytes into hexidecimal string
|
static byte | typeOfMethodSignature(String signature)
Return type of method signature as a byte value as defined in Constants
|
static byte | typeOfSignature(String signature)
Return type of signature as a byte value as defined in Constants
|
Parameters: access_flags Access flags
Returns: String representation of flags
Parameters: access_flags Access flags for_class access flags are for class qualifiers ?
Returns: String representation of flags
Returns: "class" or "interface", depending on the ACC_INTERFACE flag
Returns: `flag' with bit `i' set to 0
Parameters: code byte code array constant_pool Array of constants index offset in `code' array (number of opcodes, not bytes!) length number of opcodes to decompile, -1 for all verbose be verbose, e.g. print constant pool index
Returns: String representation of byte codes
Parameters: bytes stream of bytes constant_pool Array of constants verbose be verbose, e.g. print constant pool index
Returns: String representation of byte code
Parameters: str The long class name
Returns: Compacted class name
Parameters: str The long class name prefix The prefix the get rid off chopit Flag that determines whether chopping is executed or not
Returns: Compacted class name
Parameters: str The long class name chopit Flag that determines whether chopping is executed or not
Returns: Compacted class name
Parameters: s the string to convert uncompress use gzip to uncompress the stream of bytes
This operation inflates the original byte array by roughly 40-50%
Parameters: bytes the byte array to convert compress use gzip to minimize string
Parameters: str string to format length length of desired string left_justify format left or right fill fill character
Returns: formatted string
Parameters: i integer to format length length of desired string left_justify format left or right fill fill character
Returns: formatted int
Parameters: type Java type
Returns: byte code signature
Returns: true, if character is one of (a, ... z, A, ... Z, 0, ... 9, _)
Returns: true, if bit `i' in `flag' is set
Parameters: signature Method signature
Returns: Array of argument types
Throws: ClassFormatException
Parameters: signature Method signature chopit Shorten class names ?
Returns: Array of argument types
Throws: ClassFormatException
Parameters: signature Method signature
Returns: return type of method
Throws: ClassFormatException
Parameters: signature Method signature chopit Shorten class names ?
Returns: return type of method
Throws: ClassFormatException
Parameters: signature to convert name of method access flags of method
Returns: Human readable signature
Parameters: signature Method signature name Method name access Method access rights
Returns: Java type declaration
Throws: ClassFormatException
Parameters: ret Return type of method argv Types of method arguments
Returns: Byte code representation of method signature
Parameters: str String to permute old String to be replaced new_ Replacement string
Returns: new String object
Returns: `flag' with bit `i' set to 1
Parameters: signature to convert
Returns: Human readable signature
This method converts this string into a Java type declaration such as `String[]' and throws a `ClassFormatException' when the parsed type is invalid.::= ::= | | ::= B|C|D|F|I|J|S|Z ::= L ; ::= [ The meaning of the base types is as follows: B byte signed byte C char character D double double precision IEEE float F float single precision IEEE float I int integer J long long integer L ; ... an object of the given class S short signed short Z boolean true or false [ ... array
Parameters: signature Class signature chopit Flag that determines whether chopping is executed or not
Returns: Java type declaration
Throws: ClassFormatException
Returns: bytes as hexidecimal string, e.g. 00 FA 12 ...
Parameters: signature in format described above
Returns: type of method signature
See Also: Constants
Parameters: signature in format described above
Returns: type of signature
See Also: Constants