Package com.yworks.yguard.obf.classfile
Class ConstantPool
- java.lang.Object
-
- com.yworks.yguard.obf.classfile.ConstantPool
-
public class ConstantPool extends java.lang.ObjectA representation of the data in a Java class-file's Constant Pool. Constant Pool entries are managed by reference counting.
-
-
Constructor Summary
Constructors Constructor Description ConstantPool(ClassFile classFile, CpInfo[] cpInfo)Ctor, which initializes Constant Pool using an array of CpInfo.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddEntry(CpInfo entry)Add an entry to the constant pool and return its index.intaddUtf8Entry(java.lang.String s)voiddecRefCount(int i)Decrement the reference count for the specified element, blanking if Utf and refs are zero.java.util.Enumerationelements()Return an Enumeration of all Constant Pool entries.CpInfogetCpEntry(int i)Return the specified Constant Pool entry.voidincRefCount(int i)Increment the reference count for the specified element.intlength()Return the Constant Pool length.intremapUtf8To(java.lang.String newString, int oldIndex)Remap a specified Utf8 entry to the given value and return its new index.voidupdateRefCount()Set the reference count for each element, using references from the owning ClassFile.
-
-
-
Method Detail
-
elements
public java.util.Enumeration elements()
Return an Enumeration of all Constant Pool entries.- Returns:
- the enumeration
-
length
public int length()
Return the Constant Pool length.- Returns:
- the int
-
getCpEntry
public CpInfo getCpEntry(int i)
Return the specified Constant Pool entry.- Parameters:
i- the- Returns:
- the cp entry
-
updateRefCount
public void updateRefCount()
Set the reference count for each element, using references from the owning ClassFile.
-
incRefCount
public void incRefCount(int i)
Increment the reference count for the specified element.- Parameters:
i- the
-
remapUtf8To
public int remapUtf8To(java.lang.String newString, int oldIndex)Remap a specified Utf8 entry to the given value and return its new index.- Parameters:
newString- the new stringoldIndex- the old index- Returns:
- the int
-
decRefCount
public void decRefCount(int i)
Decrement the reference count for the specified element, blanking if Utf and refs are zero.- Parameters:
i- the
-
addEntry
public int addEntry(CpInfo entry)
Add an entry to the constant pool and return its index.- Parameters:
entry- the entry- Returns:
- the int
-
addUtf8Entry
public int addUtf8Entry(java.lang.String s)
-
-