1 17 package org.apache.bcel.classfile; 18 19 import java.io.DataInputStream ; 20 import java.io.DataOutputStream ; 21 import java.io.IOException ; 22 import org.apache.bcel.Constants; 23 24 33 public final class ConstantFloat extends Constant implements ConstantObject { 34 35 private float bytes; 36 37 38 41 public ConstantFloat(float bytes) { 42 super(Constants.CONSTANT_Float); 43 this.bytes = bytes; 44 } 45 46 47 51 public ConstantFloat(ConstantFloat c) { 52 this(c.getBytes()); 53 } 54 55 56 62 ConstantFloat(DataInputStream file) throws IOException { 63 this(file.readFloat()); 64 } 65 66 67 74 public void accept( Visitor v ) { 75 v.visitConstantFloat(this); 76 } 77 78 79 85 public final void dump( DataOutputStream file ) throws IOException { 86 file.writeByte(tag); 87 file.writeFloat(bytes); 88 } 89 90 91 94 public final float getBytes() { 95 return bytes; 96 } 97 98 99 102 public final void setBytes( float bytes ) { 103 this.bytes = bytes; 104 } 105 106 107 110 public final String toString() { 111 return super.toString() + "(bytes = " + bytes + ")"; 112 } 113 114 115 117 public Object getConstantValue( ConstantPool cp ) { 118 return new Float (bytes); 119 } 120 } 121 | Popular Tags |