KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > gjt > jclasslib > bytecode > MultianewarrayInstruction


1 /*
2     This library is free software; you can redistribute it and/or
3     modify it under the terms of the GNU General Public
4     License as published by the Free Software Foundation; either
5     version 2 of the license, or (at your option) any later version.
6 */

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 JavaDoc;
14
15 /**
16     Describes the <tt>multianewarray</tt> instruction.
17  
18     @author <a HREF="mailto:jclasslib@ej-technologies.com">Ingo Kegel</a>
19     @version $Revision: 1.5 $ $Date: 2003/08/18 07:58:35 $
20 */

21 public class MultianewarrayInstruction extends ImmediateShortInstruction {
22
23     private int dimensions;
24     
25     /**
26         Constructor.
27         @param opcode the opcode.
28      */

29     public MultianewarrayInstruction(int opcode) {
30         super(opcode);
31     }
32     
33     public int getSize() {
34         return super.getSize() + 1;
35     }
36
37     /**
38         Get the number of dimensions for the new array.
39         @return the number of dimensions
40      */

41     public int getDimensions() {
42         return dimensions;
43     }
44
45     /**
46         Set the number of dimensions for the new array.
47         @param dimensions the number of dimensions
48      */

49     public void setDimensions(int dimensions) {
50         this.dimensions = dimensions;
51     }
52
53     public void read(ByteCodeInput in) throws IOException JavaDoc {
54         super.read(in);
55
56         dimensions = in.readUnsignedByte();
57     }
58
59     public void write(ByteCodeOutput out) throws IOException JavaDoc {
60         super.write(out);
61
62         out.writeByte(dimensions);
63     }
64     
65 }
66
Popular Tags