| 1 26 package net.sf.javaguard.classfile; 27 28 import java.io.*; 29 30 31 36 public class ClassCpInfo extends CpInfo { 37 38 private int classNameIndex; 39 40 41 42 43 45 protected ClassCpInfo() { 46 super(CONSTANT_Class); 47 } 48 49 50 51 52 56 protected int getClassNameIndex() { 57 return classNameIndex; 58 } 59 60 61 65 protected void setClassNameIndex(int index) { 66 classNameIndex = index; 67 } 68 69 70 71 72 75 protected void markUtf8Refs(ConstantPool pool) { 76 pool.incRefCount(getClassNameIndex()); 77 } 78 79 80 81 82 86 protected void readInfo(DataInput din) 87 throws IOException { 88 setClassNameIndex(din.readShort()); 89 } 90 91 92 96 protected void writeInfo(DataOutput dout) 97 throws IOException { 98 dout.writeShort(getClassNameIndex()); 99 } 100 101 102 103 104 109 public void dump(PrintWriter pw, ClassFile cf, int index) { 110 pw.print('['); pw.print(index); pw.println("]: ClassCpInfo"); 111 pw.print(" -> name index: "); 112 pw.println(getClassNameIndex()); 113 pw.print(" Class: "); 114 pw.println( ((Utf8CpInfo) cf.getCpEntry(getClassNameIndex())).getString()); 115 } 116 } 117 | Popular Tags |