| 1 26 package com.yworks.yguard.obf.classfile; 27 28 import java.io.*; 29 import java.util.*; 30 31 36 abstract public class RefCpInfo extends CpInfo 37 { 38 40 41 private int u2classIndex; 43 private int u2nameAndTypeIndex; 44 45 46 48 49 protected RefCpInfo(int tag) 51 { 52 super(tag); 53 } 54 55 56 protected int getClassIndex() {return u2classIndex;} 57 58 59 protected int getNameAndTypeIndex() {return u2nameAndTypeIndex;} 60 61 62 protected void setNameAndTypeIndex(int index) {u2nameAndTypeIndex = index;} 63 64 65 protected void markNTRefs(ConstantPool pool) 66 { 67 pool.incRefCount(u2nameAndTypeIndex); 68 } 69 70 71 protected void readInfo(DataInput din) throws java.io.IOException  72 { 73 u2classIndex = din.readUnsignedShort(); 74 u2nameAndTypeIndex = din.readUnsignedShort(); 75 } 76 77 78 protected void writeInfo(DataOutput dout) throws java.io.IOException  79 { 80 dout.writeShort(u2classIndex); 81 dout.writeShort(u2nameAndTypeIndex); 82 } 83 84 85 public void dump(PrintWriter pw, ClassFile cf, int index) 86 { 87 pw.println(" Ref " + Integer.toString(index) + ": " + ((Utf8CpInfo)cf.getCpEntry(((ClassCpInfo)cf.getCpEntry(u2classIndex)).getNameIndex())).getString() + 88 " " + ((Utf8CpInfo)cf.getCpEntry(((NameAndTypeCpInfo)cf.getCpEntry(u2nameAndTypeIndex)).getNameIndex())).getString() + 89 " " + ((Utf8CpInfo)cf.getCpEntry(((NameAndTypeCpInfo)cf.getCpEntry(u2nameAndTypeIndex)).getDescriptorIndex())).getString()); 90 } 91 } 92 | Popular Tags |