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 ConstantLong extends Constant implements ConstantObject { 34 35 private long bytes; 36 37 38 41 public ConstantLong(long bytes) { 42 super(Constants.CONSTANT_Long); 43 this.bytes = bytes; 44 } 45 46 47 50 public ConstantLong(ConstantLong c) { 51 this(c.getBytes()); 52 } 53 54 55 61 ConstantLong(DataInputStream file) throws IOException { 62 this(file.readLong()); 63 } 64 65 66 73 public void accept( Visitor v ) { 74 v.visitConstantLong(this); 75 } 76 77 78 84 public final void dump( DataOutputStream file ) throws IOException { 85 file.writeByte(tag); 86 file.writeLong(bytes); 87 } 88 89 90 93 public final long getBytes() { 94 return bytes; 95 } 96 97 98 101 public final void setBytes( long 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 Long (bytes); 118 } 119 } 120 | Popular Tags |