00001 package de.fub.bytecode.classfile;
00002
00003 import de.fub.bytecode.Constants;
00004 import java.io.*;
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 public final class ConstantNameAndType extends Constant {
00017 private int name_index;
00018 private int signature_index;
00019
00020
00021
00022
00023
00024 public ConstantNameAndType(int name_index,
00025 int signature_index)
00026 {
00027 super(CONSTANT_NameAndType);
00028 this.name_index = name_index;
00029 this.signature_index = signature_index;
00030 }
00031
00032
00033
00034 public ConstantNameAndType(ConstantNameAndType c) {
00035 this(c.getNameIndex(), c.getSignatureIndex());
00036 }
00037
00038
00039
00040
00041
00042
00043 ConstantNameAndType(DataInputStream file) throws IOException
00044 {
00045 this((int)file.readUnsignedShort(), (int)file.readUnsignedShort());
00046 }
00047
00048
00049
00050
00051
00052
00053
00054 public void accept(Visitor v) {
00055 v.visitConstantNameAndType(this);
00056 }
00057
00058
00059
00060
00061
00062
00063 public final void dump(DataOutputStream file) throws IOException
00064 {
00065 file.writeByte(tag);
00066 file.writeShort(name_index);
00067 file.writeShort(signature_index);
00068 }
00069
00070
00071
00072 public final int getNameIndex() { return name_index; }
00073
00074
00075
00076 public final int getSignatureIndex() { return signature_index; }
00077
00078
00079
00080 public final void setNameIndex(int name_index) {
00081 this.name_index = name_index;
00082 }
00083
00084
00085
00086 public final void setSignatureIndex(int signature_index) {
00087 this.signature_index = signature_index;
00088 }
00089
00090
00091
00092 public final String toString() {
00093 return super.toString() + "(name_index = " + name_index +
00094 ", signature_index = " + signature_index + ")";
00095 }
00096 }