KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > yworks > yguard > obf > classfile > StackMapTableAttrInfo


1 package com.yworks.yguard.obf.classfile;
2
3 import java.io.DataInput JavaDoc;
4 import java.io.DataOutput JavaDoc;
5
6 /**
7  * Representation of an attribute.
8  *
9  */

10 public class StackMapTableAttrInfo extends AttrInfo
11 {
12     // Constants -------------------------------------------------------------
13

14
15     // Fields ----------------------------------------------------------------
16
private int u2NumberOfEntries;
17     private StackMapFrameInfo[] entries;
18
19
20     // Class Methods ---------------------------------------------------------
21

22
23     // Instance Methods ------------------------------------------------------
24
protected StackMapTableAttrInfo(ClassFile cf, int attrNameIndex, int attrLength)
25     {
26         super(cf, attrNameIndex, attrLength);
27     }
28
29     /** Return the String name of the attribute; over-ride this in sub-classes. */
30     protected String JavaDoc getAttrName()
31     {
32         return ATTR_StackMapTable;
33     }
34
35     /** Return the array of local variable table entries. */
36     protected StackMapFrameInfo[] getEntries()
37     {
38         return entries;
39     }
40
41     /** Check for Utf8 references in the 'info' data to the constant pool and mark them. */
42     protected void markUtf8RefsInInfo(ConstantPool pool)
43     {
44         for (int i = 0; i < entries.length; i++)
45         {
46             entries[i].markUtf8Refs(pool);
47         }
48     }
49
50     /** Read the data following the header. */
51     protected void readInfo(DataInput JavaDoc din) throws java.io.IOException JavaDoc
52     {
53         u2NumberOfEntries = din.readUnsignedShort();
54         entries = new StackMapFrameInfo[u2NumberOfEntries];
55         for (int i = 0; i < u2NumberOfEntries; i++)
56         {
57             entries[i] = StackMapFrameInfo.create(din);
58         }
59     }
60
61     /** Export data following the header to a DataOutput stream. */
62     public void writeInfo(DataOutput JavaDoc dout) throws java.io.IOException JavaDoc
63     {
64         dout.writeShort(u2NumberOfEntries);
65         for (int i = 0; i < u2NumberOfEntries; i++)
66         {
67             entries[i].write(dout);
68         }
69     }
70
71 }
72
Popular Tags