1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.bcel.generic;
18
19 import java.io.DataOutputStream;
20 import java.io.IOException;
21 import org.apache.bcel.util.ByteSequence;
22
23 /***
24 * GOTO_W - Branch always (to relative offset, not absolute address)
25 *
26 * @version $Id: GOTO_W.java 386056 2006-03-15 11:31:56Z tcurdt $
27 * @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
28 */
29 public class GOTO_W extends GotoInstruction {
30
31 /***
32 * Empty constructor needed for the Class.newInstance() statement in
33 * Instruction.readInstruction(). Not to be used otherwise.
34 */
35 GOTO_W() {
36 }
37
38
39 public GOTO_W(InstructionHandle target) {
40 super(org.apache.bcel.Constants.GOTO_W, target);
41 length = 5;
42 }
43
44
45 /***
46 * Dump instruction as byte code to stream out.
47 * @param out Output stream
48 */
49 public void dump( DataOutputStream out ) throws IOException {
50 index = getTargetOffset();
51 out.writeByte(opcode);
52 out.writeInt(index);
53 }
54
55
56 /***
57 * Read needed data (e.g. index) from file.
58 */
59 protected void initFromFile( ByteSequence bytes, boolean wide ) throws IOException {
60 index = bytes.readInt();
61 length = 5;
62 }
63
64
65 /***
66 * Call corresponding visitor method(s). The order is:
67 * Call visitor methods of implemented interfaces first, then
68 * call methods according to the class hierarchy in descending order,
69 * i.e., the most specific visitXXX() call comes last.
70 *
71 * @param v Visitor object
72 */
73 public void accept( Visitor v ) {
74 v.visitUnconditionalBranch(this);
75 v.visitBranchInstruction(this);
76 v.visitGotoInstruction(this);
77 v.visitGOTO_W(this);
78 }
79 }