1 package com.sun.org.apache.bcel.internal.classfile; 2 3 56 57 import com.sun.org.apache.bcel.internal.Constants; 58 import java.io.*; 59 60 69 public final class PMGClass extends Attribute { 70 private int pmg_class_index, pmg_index; 71 72 76 public PMGClass(PMGClass c) { 77 this(c.getNameIndex(), c.getLength(), c.getPMGIndex(), c.getPMGClassIndex(), 78 c.getConstantPool()); 79 } 80 81 89 PMGClass(int name_index, int length, DataInputStream file, 90 ConstantPool constant_pool) throws IOException 91 { 92 this(name_index, length, file.readUnsignedShort(), file.readUnsignedShort(), 93 constant_pool); 94 } 95 96 102 public PMGClass(int name_index, int length, int pmg_index, int pmg_class_index, 103 ConstantPool constant_pool) 104 { 105 super(Constants.ATTR_PMG, name_index, length, constant_pool); 106 this.pmg_index = pmg_index; 107 this.pmg_class_index = pmg_class_index; 108 } 109 110 117 public void accept(Visitor v) { 118 System.err.println("Visiting non-standard PMGClass object"); 119 } 120 121 127 public final void dump(DataOutputStream file) throws IOException 128 { 129 super.dump(file); 130 file.writeShort(pmg_index); 131 file.writeShort(pmg_class_index); 132 } 133 134 137 public final int getPMGClassIndex() { return pmg_class_index; } 138 139 142 public final void setPMGClassIndex(int pmg_class_index) { 143 this.pmg_class_index = pmg_class_index; 144 } 145 146 149 public final int getPMGIndex() { return pmg_index; } 150 151 154 public final void setPMGIndex(int pmg_index) { 155 this.pmg_index = pmg_index; 156 } 157 158 161 public final String getPMGName() { 162 ConstantUtf8 c = (ConstantUtf8)constant_pool.getConstant(pmg_index, 163 Constants.CONSTANT_Utf8); 164 return c.getBytes(); 165 } 166 167 170 public final String getPMGClassName() { 171 ConstantUtf8 c = (ConstantUtf8)constant_pool.getConstant(pmg_class_index, 172 Constants.CONSTANT_Utf8); 173 return c.getBytes(); 174 } 175 176 179 public final String toString() { 180 return "PMGClass(" + getPMGName() + ", " + getPMGClassName() + ")"; 181 } 182 183 186 public Attribute copy(ConstantPool constant_pool) { 187 return (PMGClass)clone(); 188 } 189 } 190 | Popular Tags |