1 package com.sun.org.apache.bcel.internal.classfile; 2 3 56 57 import com.sun.org.apache.bcel.internal.Constants; 58 import java.io.*; 59 60 69 public final class ConstantFloat extends Constant implements ConstantObject { 70 private float bytes; 71 72 75 public ConstantFloat(float bytes) 76 { 77 super(Constants.CONSTANT_Float); 78 this.bytes = bytes; 79 } 80 84 public ConstantFloat(ConstantFloat c) { 85 this(c.getBytes()); 86 } 87 93 ConstantFloat(DataInputStream file) throws IOException 94 { 95 this(file.readFloat()); 96 } 97 104 public void accept(Visitor v) { 105 v.visitConstantFloat(this); 106 } 107 113 public final void dump(DataOutputStream file) throws IOException 114 { 115 file.writeByte(tag); 116 file.writeFloat(bytes); 117 } 118 121 public final float getBytes() { return bytes; } 122 125 public final void setBytes(float bytes) { 126 this.bytes = bytes; 127 } 128 129 132 public final String toString() { 133 return super.toString() + "(bytes = " + bytes + ")"; 134 } 135 136 138 public Object getConstantValue(ConstantPool cp) { 139 return new Float (bytes); 140 } 141 } 142 | Popular Tags |