Package com.yworks.yguard.obf.classfile
Class AttrInfo
- java.lang.Object
-
- com.yworks.yguard.obf.classfile.AttrInfo
-
- All Implemented Interfaces:
ClassConstants
- Direct Known Subclasses:
AnnotationDefaultAttrInfo,BootstrapMethodsAttrInfo,CodeAttrInfo,ConstantValueAttrInfo,DeprecatedAttrInfo,EnclosingMethodAttrInfo,ExceptionsAttrInfo,InnerClassesAttrInfo,LineNumberTableAttrInfo,LocalVariableTableAttrInfo,LocalVariableTypeTableAttrInfo,MethodParametersAttrInfo,ModuleAttrInfo,ModuleMainClassAttrInfo,ModulePackagesAttrInfo,NestHostAttrInfo,NestMembersAttrInfo,PermittedSubclassesAttrInfo,RecordAttrInfo,RuntimeVisibleAnnotationsAttrInfo,RuntimeVisibleParameterAnnotationsAttrInfo,RuntimeVisibleTypeAnnotationsAttrInfo,SignatureAttrInfo,SourceFileAttrInfo,StackMapTableAttrInfo,SyntheticAttrInfo
public class AttrInfo extends java.lang.Object implements ClassConstants
Representation of an attribute. Specific attributes have their representations sub-classed from this.
-
-
Field Summary
Fields Modifier and Type Field Description static intCONSTANT_FIELD_SIZEThe constant CONSTANT_FIELD_SIZE.protected ClassFileownerThe Owner.protected intu4attrLengthThe length of the attribute in bytes.-
Fields inherited from interface com.yworks.yguard.obf.classfile.ClassConstants
ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, ATTR_AnnotationDefault, ATTR_BootstrapMethods, ATTR_Bridge, ATTR_Code, ATTR_ConstantValue, ATTR_Deprecated, ATTR_EnclosingMethod, ATTR_Enum, ATTR_Exceptions, ATTR_InnerClasses, ATTR_LineNumberTable, ATTR_LocalVariableTable, ATTR_LocalVariableTypeTable, ATTR_MethodParameters, ATTR_Module, ATTR_ModuleMainClass, ATTR_ModulePackages, ATTR_NestHost, ATTR_NestMembers, ATTR_PermittedSubclasses, ATTR_Record, ATTR_RuntimeInvisibleAnnotations, ATTR_RuntimeInvisibleParameterAnnotations, ATTR_RuntimeInvisibleTypeAnnotations, ATTR_RuntimeVisibleAnnotations, ATTR_RuntimeVisibleParameterAnnotations, ATTR_RuntimeVisibleTypeAnnotations, ATTR_Signature, ATTR_SourceDebug, ATTR_SourceDebugExtension, ATTR_SourceFile, ATTR_StackMapTable, ATTR_Synthetic, ATTR_Unknown, ATTR_Varargs, CONSTANT_Class, CONSTANT_Double, CONSTANT_Dynamic, CONSTANT_Fieldref, CONSTANT_Float, CONSTANT_Integer, CONSTANT_InterfaceMethodref, CONSTANT_InvokeDynamic, CONSTANT_Long, CONSTANT_MethodHandle, CONSTANT_Methodref, CONSTANT_MethodType, CONSTANT_Module, CONSTANT_NameAndType, CONSTANT_Package, CONSTANT_String, CONSTANT_Utf8, KNOWN_ATTRS, MAGIC, MAJOR_VERSION, MINOR_VERSION_MAX, REF_getField, REF_getStatic, REF_invokeInterface, REF_invokeSpecial, REF_invokeStatic, REF_invokeVirtual, REF_newInvokeSpecial, REF_putField, REF_putStatic, REQUIRED_ATTRS
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AttrInfocreate(java.io.DataInput din, ClassFile cf)Create a new AttrInfo from the data passed.protected intgetAttrInfoLength()Return the length of the attribute in bytes; over-ride this in sub-classes.protected java.lang.StringgetAttrName()Return the String name of the attribute; over-ride this in sub-classes.protected intgetAttrNameIndex()Get attr name index int.protected voidmarkUtf8Refs(ConstantPool pool)Check for Utf8 references to constant pool and mark them.protected voidmarkUtf8RefsInInfo(ConstantPool pool)Check for Utf8 references in the 'info' data to the constant pool and mark them; over-ride this in sub-classes.protected voidreadInfo(java.io.DataInput din)Read the data following the header; over-ride this in sub-classes.java.lang.StringtoString()protected voidtrimAttrsExcept(java.lang.String[] keepAttrs)Trim attributes from the classfile except those in the String[].voidwrite(java.io.DataOutput dout)Export the representation to a DataOutput stream.voidwriteInfo(java.io.DataOutput dout)Export data following the header to a DataOutput stream; over-ride this in sub-classes.
-
-
-
Field Detail
-
CONSTANT_FIELD_SIZE
public static final int CONSTANT_FIELD_SIZE
The constant CONSTANT_FIELD_SIZE.- See Also:
- Constant Field Values
-
u4attrLength
protected int u4attrLength
The length of the attribute in bytes.
-
owner
protected ClassFile owner
The Owner.
-
-
Constructor Detail
-
AttrInfo
protected AttrInfo(ClassFile cf, int attrNameIndex, int attrLength)
Instantiates a new Attr info.- Parameters:
cf- the cfattrNameIndex- the attr name indexattrLength- the attr length
-
-
Method Detail
-
create
public static AttrInfo create(java.io.DataInput din, ClassFile cf) throws java.io.IOException
Create a new AttrInfo from the data passed.- Parameters:
din- the dincf- the cf- Returns:
- the attr info
- Throws:
java.io.IOException- if class file is corrupt or incomplete
-
getAttrNameIndex
protected int getAttrNameIndex()
Get attr name index int.- Returns:
- the int
-
getAttrInfoLength
protected int getAttrInfoLength()
Return the length of the attribute in bytes; over-ride this in sub-classes.- Returns:
- the attr info length
-
getAttrName
protected java.lang.String getAttrName()
Return the String name of the attribute; over-ride this in sub-classes.- Returns:
- the attr name
-
trimAttrsExcept
protected void trimAttrsExcept(java.lang.String[] keepAttrs)
Trim attributes from the classfile except those in the String[].- Parameters:
keepAttrs- the keep attrs
-
markUtf8Refs
protected void markUtf8Refs(ConstantPool pool)
Check for Utf8 references to constant pool and mark them.- Parameters:
pool- the pool
-
markUtf8RefsInInfo
protected void markUtf8RefsInInfo(ConstantPool pool)
Check for Utf8 references in the 'info' data to the constant pool and mark them; over-ride this in sub-classes.- Parameters:
pool- the pool
-
readInfo
protected void readInfo(java.io.DataInput din) throws java.io.IOExceptionRead the data following the header; over-ride this in sub-classes.- Parameters:
din- the din- Throws:
java.io.IOException- the io exception
-
write
public final void write(java.io.DataOutput dout) throws java.io.IOExceptionExport the representation to a DataOutput stream.- Parameters:
dout- the dout- Throws:
java.io.IOException- the io exception
-
writeInfo
public void writeInfo(java.io.DataOutput dout) throws java.io.IOExceptionExport data following the header to a DataOutput stream; over-ride this in sub-classes.- Parameters:
dout- the dout- Throws:
java.io.IOException- the io exception
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-