1 17 package org.apache.bcel.classfile; 18 19 import java.io.DataInputStream ; 20 import java.io.DataOutputStream ; 21 import java.io.IOException ; 22 import org.apache.bcel.Constants; 23 24 32 public final class PMGClass extends Attribute { 33 34 private int pmg_class_index, pmg_index; 35 36 37 41 public PMGClass(PMGClass c) { 42 this(c.getNameIndex(), c.getLength(), c.getPMGIndex(), c.getPMGClassIndex(), c 43 .getConstantPool()); 44 } 45 46 47 55 PMGClass(int name_index, int length, DataInputStream file, ConstantPool constant_pool) 56 throws IOException { 57 this(name_index, length, file.readUnsignedShort(), file.readUnsignedShort(), constant_pool); 58 } 59 60 61 68 public PMGClass(int name_index, int length, int pmg_index, int pmg_class_index, 69 ConstantPool constant_pool) { 70 super(Constants.ATTR_PMG, name_index, length, constant_pool); 71 this.pmg_index = pmg_index; 72 this.pmg_class_index = pmg_class_index; 73 } 74 75 76 83 public void accept( Visitor v ) { 84 System.err.println("Visiting non-standard PMGClass object"); 85 } 86 87 88 94 public final void dump( DataOutputStream file ) throws IOException { 95 super.dump(file); 96 file.writeShort(pmg_index); 97 file.writeShort(pmg_class_index); 98 } 99 100 101 104 public final int getPMGClassIndex() { 105 return pmg_class_index; 106 } 107 108 109 112 public final void setPMGClassIndex( int pmg_class_index ) { 113 this.pmg_class_index = pmg_class_index; 114 } 115 116 117 120 public final int getPMGIndex() { 121 return pmg_index; 122 } 123 124 125 128 public final void setPMGIndex( int pmg_index ) { 129 this.pmg_index = pmg_index; 130 } 131 132 133 136 public final String getPMGName() { 137 ConstantUtf8 c = (ConstantUtf8) constant_pool.getConstant(pmg_index, 138 Constants.CONSTANT_Utf8); 139 return c.getBytes(); 140 } 141 142 143 146 public final String getPMGClassName() { 147 ConstantUtf8 c = (ConstantUtf8) constant_pool.getConstant(pmg_class_index, 148 Constants.CONSTANT_Utf8); 149 return c.getBytes(); 150 } 151 152 153 156 public final String toString() { 157 return "PMGClass(" + getPMGName() + ", " + getPMGClassName() + ")"; 158 } 159 160 161 164 public Attribute copy( ConstantPool _constant_pool ) { 165 return (PMGClass) clone(); 166 } 167 } 168 | Popular Tags |