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 ConstantDouble extends Constant implements ConstantObject { 34 35 private double bytes; 36 37 38 41 public ConstantDouble(double bytes) { 42 super(Constants.CONSTANT_Double); 43 this.bytes = bytes; 44 } 45 46 47 50 public ConstantDouble(ConstantDouble c) { 51 this(c.getBytes()); 52 } 53 54 55 61 ConstantDouble(DataInputStream file) throws IOException { 62 this(file.readDouble()); 63 } 64 65 66 73 public void accept( Visitor v ) { 74 v.visitConstantDouble(this); 75 } 76 77 78 84 public final void dump( DataOutputStream file ) throws IOException { 85 file.writeByte(tag); 86 file.writeDouble(bytes); 87 } 88 89 90 93 public final double getBytes() { 94 return bytes; 95 } 96 97 98 101 public final void setBytes( double bytes ) { 102 this.bytes = bytes; 103 } 104 105 106 109 public final String toString() { 110 return super.toString() + "(bytes = " + bytes + ")"; 111 } 112 113 114 116 public Object getConstantValue( ConstantPool cp ) { 117 return new Double (bytes); 118 } 119 } 120 | Popular Tags |