001package serp.bytecode.lowlevel;
002
003import java.io.DataInput;
004import java.io.DataOutput;
005import java.io.IOException;
006
007import serp.bytecode.visitor.BCVisitor;
008
009/**
010 * MethodType 
011 *  u1 tag 
012 *  u2 descriptor_index
013 *
014 */
015public class MethodTypeEntry extends Entry {
016    private int _descriptor_index;      // Must ref a UTF8Entry representing a method descriptor
017
018    public MethodTypeEntry() {
019
020    }
021
022    public MethodTypeEntry(int _descriptor_index) {
023        this._descriptor_index = _descriptor_index;
024    }
025
026    public void acceptVisit(BCVisitor visitor) {
027        visitor.enterMethodTypeEntry(this);
028        visitor.exitMethodTypeEntry(this);
029    }
030
031    public int getType() {
032        return Entry.METHODTYPE;
033    }
034
035    void readData(DataInput in) throws IOException {
036        _descriptor_index = in.readUnsignedShort();
037    }
038
039    void writeData(DataOutput out) throws IOException {
040        out.writeShort(_descriptor_index);
041    }
042
043    public UTF8Entry getMethodDescriptorEntry() {
044        return (UTF8Entry) getPool().getEntry(_descriptor_index);
045    }
046}