1 7 package org.gjt.jclasslib.structures.attributes; 8 9 import org.gjt.jclasslib.structures.AttributeInfo; 10 import org.gjt.jclasslib.structures.InvalidByteCodeException; 11 12 import java.io.*; 13 14 20 public class EnclosingMethodAttribute extends AttributeInfo { 21 24 public static final String ATTRIBUTE_NAME = "EnclosingMethod"; 25 26 private static final int LENGTH = 4; 27 28 private int classInfoIndex; 29 private int methodInfoIndex; 30 31 38 public int getClassInfoIndex() { 39 return classInfoIndex; 40 } 41 42 49 public int getMethodInfoIndex() { 50 return methodInfoIndex; 51 } 52 53 public void read(DataInput in) 54 throws InvalidByteCodeException, IOException { 55 super.read(in); 56 57 classInfoIndex = in.readUnsignedShort(); 58 methodInfoIndex = in.readUnsignedShort(); 59 60 if (debug) debug("read "); 61 } 62 63 public void write(DataOutput out) 64 throws InvalidByteCodeException, IOException { 65 super.write(out); 66 67 out.writeShort(classInfoIndex); 68 out.writeShort(methodInfoIndex); 69 70 if (debug) debug("wrote "); 71 } 72 73 public int getAttributeLength() { 74 return LENGTH; 75 } 76 77 protected void debug(String message) { 78 super.debug(message + "EnclosingMethod attribute with class index " + 79 classInfoIndex + " and method index " + methodInfoIndex); 80 } 81 } 82 | Popular Tags |