FileDocCategorySizeDatePackage
StackMap.javaAPI DocJava SE 5 API6199Fri Aug 26 14:55:18 BST 2005com.sun.org.apache.bcel.internal.classfile

StackMap

public final class StackMap extends Attribute implements Node
This class represents a stack map attribute used for preverification of Java classes for the Java 2 Micro Edition (J2ME). This attribute is used by the KVM and contained within the Code attribute of a method. See CLDC specification ÷5.3.1.2
version
$Id: StackMap.java,v 1.1.1.1 2001/10/29 20:00:03 jvanzyl Exp $
author
M. Dahm
see
Code
see
StackMapEntry
see
StackMapType

Fields Summary
private int
map_length
private StackMapEntry[]
map
Constructors Summary
public StackMap(int name_index, int length, StackMapEntry[] map, ConstantPool constant_pool)

    super(Constants.ATTR_STACK_MAP, name_index, length, constant_pool);

    setStackMap(map);
  
StackMap(int name_index, int length, DataInputStream file, ConstantPool constant_pool)
Construct object from file stream.

param
name_index Index of name
param
length Content length in bytes
param
file Input stream
throw
IOException
param
constant_pool Array of constants

    this(name_index, length, (StackMapEntry[])null, constant_pool);

    map_length = file.readUnsignedShort();
    map = new StackMapEntry[map_length];

    for(int i=0; i < map_length; i++)
      map[i] = new StackMapEntry(file, constant_pool);
  
Methods Summary
public voidaccept(com.sun.org.apache.bcel.internal.classfile.Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

param
v Visitor object

     v.visitStackMap(this);
   
public com.sun.org.apache.bcel.internal.classfile.Attributecopy(com.sun.org.apache.bcel.internal.classfile.ConstantPool constant_pool)

return
deep copy of this attribute

    StackMap c = (StackMap)clone();

    c.map = new StackMapEntry[map_length];
    for(int i=0; i < map_length; i++)
      c.map[i] = map[i].copy();

    c.constant_pool = constant_pool;
    return c;
  
public final voiddump(java.io.DataOutputStream file)
Dump line number table attribute to file stream in binary format.

param
file Output file stream
throw
IOException

    super.dump(file);
    file.writeShort(map_length);
    for(int i=0; i < map_length; i++)
      map[i].dump(file);
  
public final intgetMapLength()

 return map_length; 
public final com.sun.org.apache.bcel.internal.classfile.StackMapEntry[]getStackMap()

return
Array of stack map entries

 return map; 
public final voidsetStackMap(com.sun.org.apache.bcel.internal.classfile.StackMapEntry[] map)

param
map Array of stack map entries

    this.map = map;

    map_length = (map == null)? 0 : map.length;
  
public final java.lang.StringtoString()

return
String representation.

    StringBuffer buf = new StringBuffer("StackMap(");

    for(int i=0; i < map_length; i++) {
      buf.append(map[i].toString());

      if(i < map_length - 1)
	buf.append(", ");
    }

    buf.append(')");
	
    return buf.toString();