|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.aspectj.apache.bcel.classfile.Utility
public abstract class Utility
Utility functions that do not really belong to any class in particular.
Nested Class Summary | |
---|---|
static class |
Utility.ResultHolder
|
Constructor Summary | |
---|---|
Utility()
|
Method Summary | |
---|---|
static java.lang.String |
accessToString(int access_flags)
Convert bit field of flags into string such as 'static final'. |
static java.lang.String |
accessToString(int access_flags,
boolean for_class)
Convert bit field of flags into string such as 'static final'. |
static java.lang.String |
classOrInterface(int access_flags)
|
static java.lang.String |
codeToString(byte[] code,
ConstantPool constant_pool,
int index,
int length)
Disassemble a stream of byte codes and return the string representation. |
static java.lang.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 java.lang.String |
codeToString(ByteSequence bytes,
ConstantPool constant_pool)
|
static java.lang.String |
codeToString(ByteSequence bytes,
ConstantPool constant_pool,
boolean verbose)
Disassemble a stream of byte codes and return the string representation. |
static java.lang.String |
compactClassName(java.lang.String str)
Shorten long class names, java/lang/String becomes String. |
static java.lang.String |
compactClassName(java.lang.String str,
boolean chopit)
Shorten long class names, java/lang/String becomes java.lang.String, e.g.. |
static java.lang.String |
compactClassName(java.lang.String str,
java.lang.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 java.lang.String |
convertString(java.lang.String label)
Escape all occurences of newline chars '\n', quotes \", etc. |
static java.lang.String |
fillup(java.lang.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 java.lang.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 java.util.Collection<RuntimeAnnos> |
getAnnotationAttributes(ConstantPool cp,
java.util.List<AnnotationGen> annotations)
Converts a list of AnnotationGen objects into a set of attributes that can be attached to the class file. |
static Attribute[] |
getParameterAnnotationAttributes(ConstantPool cp,
java.util.List<AnnotationGen>[] vec)
Annotations against a class are stored in one of four attribute kinds: - RuntimeVisibleParameterAnnotations - RuntimeInvisibleParameterAnnotations |
static java.lang.String |
methodSignatureToString(java.lang.String signature,
java.lang.String name,
java.lang.String access)
|
static java.lang.String |
methodSignatureToString(java.lang.String signature,
java.lang.String name,
java.lang.String access,
boolean chopit)
|
static java.lang.String |
methodSignatureToString(java.lang.String signature,
java.lang.String name,
java.lang.String access,
boolean chopit,
LocalVariableTable vars)
This method converts such a string into a Java type declaration like 'void main(String[])' and throws a 'ClassFormatException' when the parsed type is invalid. |
static java.lang.String |
replace(java.lang.String str,
java.lang.String old,
java.lang.String new_)
Replace all occurences of old in str with new. |
static java.lang.String |
signatureToString(java.lang.String signature)
Converts signature to string with all class names compacted. |
static java.lang.String |
signatureToString(java.lang.String signature,
boolean chopit)
|
static Utility.ResultHolder |
signatureToStringInternal(java.lang.String signature,
boolean chopit)
This method converts this string into a Java type declaration such as 'String[]' and throws a `ClassFormatException' when the parsed type is invalid. |
static java.lang.String |
toHexString(byte[] bytes)
Convert bytes into hexidecimal string |
static java.lang.String |
toMethodSignature(Type returnType,
Type[] argTypes)
Convert type to Java method signature, e.g. |
static byte |
typeOfMethodSignature(java.lang.String signature)
Return type of method signature as a byte value as defined in Constants |
static byte |
typeOfSignature(char c)
|
static byte |
typeOfSignature(java.lang.String signature)
Return type of signature as a byte value as defined in Constants |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Utility()
Method Detail |
---|
public static final java.lang.String accessToString(int access_flags)
access_flags
- Access flags
public static final java.lang.String accessToString(int access_flags, boolean for_class)
access_flags
- Access flagsfor_class
- access flags are for class qualifiers ?
public static final java.lang.String classOrInterface(int access_flags)
public static final java.lang.String codeToString(byte[] code, ConstantPool constant_pool, int index, int length, boolean verbose)
code
- byte code arrayconstant_pool
- Array of constantsindex
- offset in `code' array (number of opcodes, not bytes!)length
- number of opcodes to decompile, -1 for allverbose
- be verbose, e.g. print constant pool index
public static final java.lang.String codeToString(byte[] code, ConstantPool constant_pool, int index, int length)
public static final java.lang.String codeToString(ByteSequence bytes, ConstantPool constant_pool) throws java.io.IOException
java.io.IOException
public static final java.lang.String compactClassName(java.lang.String str)
str
- The long class name
public static final java.lang.String compactClassName(java.lang.String str, java.lang.String prefix, boolean chopit)
str
- The long class nameprefix
- The prefix the get rid offchopit
- Flag that determines whether chopping is executed or not
public static final java.lang.String compactClassName(java.lang.String str, boolean chopit)
str
- The long class namechopit
- Flag that determines whether chopping is executed or not
public static final java.lang.String methodSignatureToString(java.lang.String signature, java.lang.String name, java.lang.String access)
public static final java.lang.String methodSignatureToString(java.lang.String signature, java.lang.String name, java.lang.String access, boolean chopit)
public static final java.lang.String methodSignatureToString(java.lang.String signature, java.lang.String name, java.lang.String access, boolean chopit, LocalVariableTable vars) throws ClassFormatException
ClassFormatException
public static final java.lang.String replace(java.lang.String str, java.lang.String old, java.lang.String new_)
str
- String to permuteold
- String to be replacednew
- Replacement string
public static final java.lang.String signatureToString(java.lang.String signature)
signature
- to convert
public static final java.lang.String signatureToString(java.lang.String signature, boolean chopit)
public static final Utility.ResultHolder signatureToStringInternal(java.lang.String signature, boolean chopit)
public static final byte typeOfMethodSignature(java.lang.String signature) throws ClassFormatException
signature
- in format described above
ClassFormatException
Constants
public static final java.lang.String toHexString(byte[] bytes)
public static final java.lang.String format(int i, int length, boolean left_justify, char fill)
i
- integer to formatlength
- length of desired stringleft_justify
- format left or rightfill
- fill character
public static final java.lang.String fillup(java.lang.String str, int length, boolean left_justify, char fill)
str
- string to formatlength
- length of desired stringleft_justify
- format left or rightfill
- fill character
public static final java.lang.String convertString(java.lang.String label)
public static java.util.Collection<RuntimeAnnos> getAnnotationAttributes(ConstantPool cp, java.util.List<AnnotationGen> annotations)
cp
- The constant pool gen where we can create the necessary name refsannotations
- A list of AnnotationGen objectspublic static Attribute[] getParameterAnnotationAttributes(ConstantPool cp, java.util.List<AnnotationGen>[] vec)
public static final byte typeOfSignature(java.lang.String signature) throws ClassFormatException
signature
- in format described above
ClassFormatException
Constants
public static final byte typeOfSignature(char c) throws ClassFormatException
ClassFormatException
public static final java.lang.String codeToString(ByteSequence bytes, ConstantPool constant_pool, boolean verbose) throws java.io.IOException
bytes
- stream of bytesconstant_pool
- Array of constantsverbose
- be verbose, e.g. print constant pool index
java.io.IOException
public static java.lang.String toMethodSignature(Type returnType, Type[] argTypes)
returnType
- what the method returnsargTypes
- what are the argument types
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |