FileDocCategorySizeDatePackage
NEWARRAY.javaAPI DocJava SE 5 API5088Fri Aug 26 14:55:24 BST 2005com.sun.org.apache.bcel.internal.generic

NEWARRAY

public class NEWARRAY extends Instruction implements ExceptionThrower, StackProducer, AllocationInstruction
NEWARRAY - Create new array of basic type (int, short, ...)
Stack: ..., count -> ..., arrayref
type must be one of T_INT, T_SHORT, ...
version
$Id: NEWARRAY.java,v 1.1.1.1 2001/10/29 20:00:25 jvanzyl Exp $
author
M. Dahm

Fields Summary
private byte
type
Constructors Summary
NEWARRAY()
Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction(). Not to be used otherwise.

public NEWARRAY(byte type)

    super(com.sun.org.apache.bcel.internal.Constants.NEWARRAY, (short)2);
    this.type = type;
  
public NEWARRAY(BasicType type)

      this(type.getType());
  
Methods Summary
public voidaccept(com.sun.org.apache.bcel.internal.generic.Visitor v)
Call corresponding visitor method(s). The order is: Call visitor methods of implemented interfaces first, then call methods according to the class hierarchy in descending order, i.e., the most specific visitXXX() call comes last.

param
v Visitor object

    v.visitAllocationInstruction(this);
    v.visitExceptionThrower(this);
    v.visitStackProducer(this);
    v.visitNEWARRAY(this);
  
public voiddump(java.io.DataOutputStream out)
Dump instruction as byte code to stream out.

param
out Output stream

    out.writeByte(opcode);
    out.writeByte(type);
  
public java.lang.Class[]getExceptions()

    return new Class[] { com.sun.org.apache.bcel.internal.ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION };
  
public final com.sun.org.apache.bcel.internal.generic.TypegetType()

return
type of constructed array

    return new ArrayType(BasicType.getType(type), 1);
  
public final bytegetTypecode()

return
numeric code for basic element type

 return type; 
protected voidinitFromFile(com.sun.org.apache.bcel.internal.util.ByteSequence bytes, boolean wide)
Read needed data (e.g. index) from file.

    type   = bytes.readByte();
    length = 2;
  
public java.lang.StringtoString(boolean verbose)

return
mnemonic for instruction

    return super.toString(verbose) + " " + com.sun.org.apache.bcel.internal.Constants.TYPE_NAMES[type];