1 7 8 package org.gjt.jclasslib.bytecode; 9 10 import org.gjt.jclasslib.io.ByteCodeInput; 11 import org.gjt.jclasslib.io.ByteCodeOutput; 12 13 import java.io.IOException ; 14 15 21 public class IncrementInstruction extends ImmediateByteInstruction { 22 23 private int incrementConst; 24 25 30 public IncrementInstruction(int opcode, boolean wide) { 31 super(opcode, wide); 32 } 33 34 41 public IncrementInstruction(int opcode, boolean wide, int immediateByte, int incrementConst) { 42 super(opcode, wide, immediateByte); 43 this.incrementConst = incrementConst; 44 } 45 46 47 public int getSize() { 48 return super.getSize() + (wide ? 2 : 1); 49 } 50 51 55 public int getIncrementConst() { 56 return incrementConst; 57 } 58 59 63 public void setIncrementConst(int incrementConst) { 64 this.incrementConst = incrementConst; 65 } 66 67 public void read(ByteCodeInput in) throws IOException { 68 super.read(in); 69 70 if (wide) { 71 incrementConst = in.readUnsignedShort(); 72 } else { 73 incrementConst = in.readUnsignedByte(); 74 } 75 } 76 77 public void write(ByteCodeOutput out) throws IOException { 78 super.write(out); 79 80 if (wide) { 81 out.writeShort(incrementConst); 82 } else { 83 out.writeByte(incrementConst); 84 } 85 } 86 87 } 88 | Popular Tags |