1 7 8 package org.gjt.jclasslib.structures.constants; 9 10 import org.gjt.jclasslib.structures.CPInfo; 11 import org.gjt.jclasslib.structures.InvalidByteCodeException; 12 13 import java.io.*; 14 15 21 public abstract class ConstantNumeric extends CPInfo { 22 23 24 public static final int SIZE = 4; 25 26 27 protected int bytes; 28 29 33 public int getBytes() { 34 return bytes; 35 } 36 37 41 public void setBytes(int bytes) { 42 this.bytes = bytes; 43 } 44 45 50 public String getFormattedBytes() { 51 return printBytes(bytes); 52 } 53 54 public void read(DataInput in) 55 throws InvalidByteCodeException, IOException { 56 57 bytes = in.readInt(); 58 } 59 60 public void write(DataOutput out) 61 throws InvalidByteCodeException, IOException { 62 63 out.writeInt(bytes); 64 } 65 66 public boolean equals(Object object) { 67 if (!(object instanceof ConstantNumeric)) { 68 return false; 69 } 70 ConstantNumeric constantNumeric = (ConstantNumeric)object; 71 return super.equals(object) && constantNumeric.bytes == bytes; 72 } 73 74 public int hashCode() { 75 return super.hashCode() ^ bytes; 76 } 77 78 } 79 | Popular Tags |