FileDocCategorySizeDatePackage
StackMap.javaAPI DocJava SE 6 API6198Tue Jun 10 00:22:18 BST 2008com.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.2.1 2005/07/31 23:46:28 jeffsuttor 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
throws
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
throws
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();