package sophomore.classfile.constantpool;

import java.io.IOException;
import java.io.RandomAccessFile;

/**
 * 
 * @author inagaki
 */
public class MethodHandleInfo extends ConstantInfo {
	/**
	 * 
	 */
	int referenceKind;
	/**
	 * 
	 */
	int referenceIndex;

	 /**
	  * 
	  */
	public MethodHandleInfo() {
		super(ConstantType.C_METHOD_HANDLE);
	}

	/**
	 * 
	 * @return 
	 */
	public int getReferenceKind() {
		return referenceKind;
	}

	/**
	 * 
	 * @return 
	 */
	public int getReferenceIndex() {
		return referenceIndex;
	}

	@Override
	public void read(RandomAccessFile raf) throws IOException {
		this.referenceKind  = raf.readByte();
		this.referenceIndex = raf.readShort();
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		String sep = System.getProperty("line.separator");
		sb.append(super.toString()).append(sep).append("\t")
			.append("reference kind : ").append(referenceKind).append(sep).append("\t")
			.append("reference index: ").append(referenceIndex);
		return sb.toString();
	}
}
@@ -254,16 +254,598 @@
 Index;%0A%0A
+%09/**%0A%09 * %0A%09 */%0A%09public static final int REF_GET_FIELD  = 1;%0A%09/**%0A%09 * %0A%09 */%0A%09public static final int REF_GET_STATIC = 2;%0A%09/**%0A%09 * %0A%09 */%0A%09public static final int REF_PUT_FIELD  = 3;%0A%09/**%0A%09 * %0A%09 */%0A%09public static final int REF_PUT_STATIC = 4;%0A%09/**%0A%09 * %0A%09 */%0A%09public static final int REF_INVOKE_VIRTUAL     = 5;%0A%09/**%0A%09 * %0A%09 */%0A%09public static final int REF_INVOKE_STATIC      = 6;%0A%09/**%0A%09 * %0A%09 */%0A%09public static final int REF_INVOKE_SPECIAL     = 7;%0A%09/**%0A%09 * %0A%09 */%0A%09public static final int REF_NEW_INVOKE_SPECIAL = 8;%0A%09/**%0A%09 * %0A%09 */%0A%09public static final int REF_INVOKE_INTERFACE   = 9;%0A%09%0A
 %09 /**%0A%09 

add constant-values for reference-kind.