Package javassist.bytecode
Class AttributeInfo
- java.lang.Object
-
- javassist.bytecode.AttributeInfo
-
- Direct Known Subclasses:
AnnotationDefaultAttribute
,AnnotationsAttribute
,BootstrapMethodsAttribute
,CodeAttribute
,ConstantAttribute
,DeprecatedAttribute
,EnclosingMethodAttribute
,ExceptionsAttribute
,InnerClassesAttribute
,LineNumberAttribute
,LocalVariableAttribute
,MethodParametersAttribute
,NestHostAttribute
,NestMembersAttribute
,ParameterAnnotationsAttribute
,SignatureAttribute
,SourceFileAttribute
,StackMap
,StackMapTable
,SyntheticAttribute
,TypeAnnotationsAttribute
public class AttributeInfo extends java.lang.Object
attribute_info
structure.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AttributeInfo(ConstPool cp, int attrname, byte[] attrinfo)
protected
AttributeInfo(ConstPool cp, int n, java.io.DataInputStream in)
protected
AttributeInfo(ConstPool cp, java.lang.String attrname)
AttributeInfo(ConstPool cp, java.lang.String attrname, byte[] attrinfo)
Constructs anattribute_info
structure.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributeInfo
copy(ConstPool newCp, java.util.Map<java.lang.String,java.lang.String> classnames)
Makes a copy.(package private) static java.util.List<AttributeInfo>
copyAll(java.util.List<AttributeInfo> attributes, ConstPool cp)
byte[]
get()
Returns theinfo
field of thisattribute_info
structure.ConstPool
getConstPool()
Returns a constant pool table.(package private) static int
getLength(java.util.List<AttributeInfo> attributes)
java.lang.String
getName()
Returns an attribute name.(package private) static void
getRefClasses(java.util.List<AttributeInfo> attributes, java.util.Map<java.lang.String,java.lang.String> classnames)
(package private) void
getRefClasses(java.util.Map<java.lang.String,java.lang.String> classnames)
int
length()
Returns the length of thisattribute_info
structure.(package private) static AttributeInfo
lookup(java.util.List<AttributeInfo> attributes, java.lang.String name)
(package private) static AttributeInfo
read(ConstPool cp, java.io.DataInputStream in)
(package private) static AttributeInfo
remove(java.util.List<AttributeInfo> attributes, java.lang.String name)
(package private) void
renameClass(java.lang.String oldname, java.lang.String newname)
(package private) static void
renameClass(java.util.List<AttributeInfo> attributes, java.lang.String oldname, java.lang.String newname)
(package private) static void
renameClass(java.util.List<AttributeInfo> attributes, java.util.Map<java.lang.String,java.lang.String> classnames)
(package private) void
renameClass(java.util.Map<java.lang.String,java.lang.String> classnames)
void
set(byte[] newinfo)
Sets theinfo
field of thisattribute_info
structure.(package private) void
write(java.io.DataOutputStream out)
(package private) static void
writeAll(java.util.List<AttributeInfo> attributes, java.io.DataOutputStream out)
-
-
-
Field Detail
-
constPool
protected ConstPool constPool
-
name
int name
-
info
byte[] info
-
-
Constructor Detail
-
AttributeInfo
protected AttributeInfo(ConstPool cp, int attrname, byte[] attrinfo)
-
AttributeInfo
protected AttributeInfo(ConstPool cp, java.lang.String attrname)
-
AttributeInfo
public AttributeInfo(ConstPool cp, java.lang.String attrname, byte[] attrinfo)
Constructs anattribute_info
structure.- Parameters:
cp
- constant pool tableattrname
- attribute nameattrinfo
-info
field ofattribute_info
structure.
-
AttributeInfo
protected AttributeInfo(ConstPool cp, int n, java.io.DataInputStream in) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
read
static AttributeInfo read(ConstPool cp, java.io.DataInputStream in) throws java.io.IOException
- Throws:
java.io.IOException
-
getName
public java.lang.String getName()
Returns an attribute name.
-
getConstPool
public ConstPool getConstPool()
Returns a constant pool table.
-
length
public int length()
Returns the length of thisattribute_info
structure. The returned value isattribute_length + 6
.
-
get
public byte[] get()
Returns theinfo
field of thisattribute_info
structure.This method is not available if the object is an instance of
CodeAttribute
.
-
set
public void set(byte[] newinfo)
Sets theinfo
field of thisattribute_info
structure.This method is not available if the object is an instance of
CodeAttribute
.
-
copy
public AttributeInfo copy(ConstPool newCp, java.util.Map<java.lang.String,java.lang.String> classnames)
Makes a copy. Class names are replaced according to the givenMap
object.- Parameters:
newCp
- the constant pool table used by the new copy.classnames
- pairs of replaced and substituted class names.
-
write
void write(java.io.DataOutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
getLength
static int getLength(java.util.List<AttributeInfo> attributes)
-
lookup
static AttributeInfo lookup(java.util.List<AttributeInfo> attributes, java.lang.String name)
-
remove
static AttributeInfo remove(java.util.List<AttributeInfo> attributes, java.lang.String name)
-
writeAll
static void writeAll(java.util.List<AttributeInfo> attributes, java.io.DataOutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
copyAll
static java.util.List<AttributeInfo> copyAll(java.util.List<AttributeInfo> attributes, ConstPool cp)
-
renameClass
void renameClass(java.lang.String oldname, java.lang.String newname)
-
renameClass
void renameClass(java.util.Map<java.lang.String,java.lang.String> classnames)
-
renameClass
static void renameClass(java.util.List<AttributeInfo> attributes, java.lang.String oldname, java.lang.String newname)
-
renameClass
static void renameClass(java.util.List<AttributeInfo> attributes, java.util.Map<java.lang.String,java.lang.String> classnames)
-
getRefClasses
void getRefClasses(java.util.Map<java.lang.String,java.lang.String> classnames)
-
getRefClasses
static void getRefClasses(java.util.List<AttributeInfo> attributes, java.util.Map<java.lang.String,java.lang.String> classnames)
-
-