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 BranchInstruction extends AbstractInstruction { 22 23 private int branchOffset; 24 25 29 public BranchInstruction(int opcode) { 30 super(opcode); 31 } 32 33 38 public BranchInstruction(int opcode, int branchOffset) { 39 super(opcode); 40 this.branchOffset = branchOffset; 41 } 42 43 public int getSize() { 44 return super.getSize() + 2; 45 } 46 47 51 public int getBranchOffset() { 52 return branchOffset; 53 } 54 55 59 public void setBranchOffset(int branchOffset) { 60 this.branchOffset = branchOffset; 61 } 62 63 public void read(ByteCodeInput in) throws IOException { 64 super.read(in); 65 66 branchOffset = in.readShort(); 67 } 68 69 public void write(ByteCodeOutput out) throws IOException { 70 super.write(out); 71 72 out.writeShort(branchOffset); 73 } 74 75 } 76 | Popular Tags |