1 2 package com.sun.org.apache.bcel.internal.classfile; 3 4 57 58 59 import com.sun.org.apache.bcel.internal.Constants; 60 import java.io.*; 61 62 71 public final class ConstantInteger extends Constant implements ConstantObject { 72 private int bytes; 73 74 77 public ConstantInteger(int bytes) 78 { 79 super(Constants.CONSTANT_Integer); 80 this.bytes = bytes; 81 } 82 83 86 public ConstantInteger(ConstantInteger c) { 87 this(c.getBytes()); 88 } 89 90 96 ConstantInteger(DataInputStream file) throws IOException 97 { 98 this(file.readInt()); 99 } 100 101 108 public void accept(Visitor v) { 109 v.visitConstantInteger(this); 110 } 111 112 118 public final void dump(DataOutputStream file) throws IOException 119 { 120 file.writeByte(tag); 121 file.writeInt(bytes); 122 } 123 124 127 public final int getBytes() { return bytes; } 128 129 132 public final void setBytes(int bytes) { 133 this.bytes = bytes; 134 } 135 136 139 public final String toString() { 140 return super.toString() + "(bytes = " + bytes + ")"; 141 } 142 143 145 public Object getConstantValue(ConstantPool cp) { 146 return new Integer (bytes); 147 } 148 } 149 | Popular Tags |