Package com.yworks.yguard.obf.classfile
Class CpInfo
- java.lang.Object
-
- com.yworks.yguard.obf.classfile.CpInfo
-
- All Implemented Interfaces:
ClassConstants
- Direct Known Subclasses:
AbstractDynamicCpInfo,AbstractTypeCpInfo,DoubleCpInfo,FloatCpInfo,IntegerCpInfo,LongCpInfo,MethodHandleCpInfo,MethodTypeCpInfo,NameAndTypeCpInfo,RefCpInfo,StringCpInfo,Utf8CpInfo
public abstract class CpInfo extends java.lang.Object implements ClassConstants
Representation of an entry in the ConstantPool. Specific types of entry have their representations sub-classed from this.
-
-
Field Summary
Fields Modifier and Type Field Description protected intrefCountThe Ref count.-
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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCpInfo(int tag)Instantiates a new Cp info.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static CpInfocreate(java.io.DataInput din)Create a new CpInfo from the data passed.voiddecRefCount()Decrement the reference count.voiddump(java.io.PrintWriter pw, ClassFile cf, int index)Dump the content of the class file to the specified file (used for debugging).intgetRefCount()Return the reference count.voidincRefCount()Increment the reference count.protected voidmarkNTRefs(ConstantPool pool)Check for NameAndType references to constant pool and mark them; over-ride this in sub-classes.protected voidmarkUtf8Refs(ConstantPool pool)Check for Utf8 references to constant pool and mark them; over-ride this in sub-classes.protected abstract voidreadInfo(java.io.DataInput din)Read the 'info' data following the u1tag byte; over-ride this in sub-classes.voidresetRefCount()Reset the reference count to zero.voidwrite(java.io.DataOutput dout)Export the representation to a DataOutput stream.protected abstract voidwriteInfo(java.io.DataOutput dout)Write the 'info' data following the u1tag byte; over-ride this in sub-classes.
-
-
-
Method Detail
-
create
public static CpInfo create(java.io.DataInput din) throws java.io.IOException
Create a new CpInfo from the data passed.- Parameters:
din- the din- Returns:
- the cp info
- Throws:
java.io.IOException- if class file is corrupt or incomplete
-
readInfo
protected abstract void readInfo(java.io.DataInput din) throws java.io.IOExceptionRead the 'info' data following the u1tag byte; over-ride this in sub-classes.- Parameters:
din- the din- Throws:
java.io.IOException- the io exception
-
markUtf8Refs
protected void markUtf8Refs(ConstantPool pool)
Check for Utf8 references to constant pool and mark them; over-ride this in sub-classes.- Parameters:
pool- the pool
-
markNTRefs
protected void markNTRefs(ConstantPool pool)
Check for NameAndType references to constant pool and mark them; over-ride this in sub-classes.- Parameters:
pool- the pool
-
write
public 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
protected abstract void writeInfo(java.io.DataOutput dout) throws java.io.IOExceptionWrite the 'info' data following the u1tag byte; over-ride this in sub-classes.- Parameters:
dout- the dout- Throws:
java.io.IOException- the io exception
-
getRefCount
public int getRefCount()
Return the reference count.- Returns:
- the ref count
-
incRefCount
public void incRefCount()
Increment the reference count.
-
decRefCount
public void decRefCount()
Decrement the reference count.
-
resetRefCount
public void resetRefCount()
Reset the reference count to zero.
-
dump
public void dump(java.io.PrintWriter pw, ClassFile cf, int index)Dump the content of the class file to the specified file (used for debugging).- Parameters:
pw- the pwcf- the cfindex- the index
-
-