01: package com.yworks.yguard.obf.classfile;
02:
03: import java.io.DataInput;
04: import java.io.DataOutput;
05:
06: /**
07: * Representation of an attribute.
08: *
09: */
10: public class StackMapTableAttrInfo extends AttrInfo {
11: // Constants -------------------------------------------------------------
12:
13: // Fields ----------------------------------------------------------------
14: private int u2NumberOfEntries;
15: private StackMapFrameInfo[] entries;
16:
17: // Class Methods ---------------------------------------------------------
18:
19: // Instance Methods ------------------------------------------------------
20: protected StackMapTableAttrInfo(ClassFile cf, int attrNameIndex,
21: int attrLength) {
22: super (cf, attrNameIndex, attrLength);
23: }
24:
25: /** Return the String name of the attribute; over-ride this in sub-classes. */
26: protected String getAttrName() {
27: return ATTR_StackMapTable;
28: }
29:
30: /** Return the array of local variable table entries. */
31: protected StackMapFrameInfo[] getEntries() {
32: return entries;
33: }
34:
35: /** Check for Utf8 references in the 'info' data to the constant pool and mark them. */
36: protected void markUtf8RefsInInfo(ConstantPool pool) {
37: for (int i = 0; i < entries.length; i++) {
38: entries[i].markUtf8Refs(pool);
39: }
40: }
41:
42: /** Read the data following the header. */
43: protected void readInfo(DataInput din) throws java.io.IOException {
44: u2NumberOfEntries = din.readUnsignedShort();
45: entries = new StackMapFrameInfo[u2NumberOfEntries];
46: for (int i = 0; i < u2NumberOfEntries; i++) {
47: entries[i] = StackMapFrameInfo.create(din);
48: }
49: }
50:
51: /** Export data following the header to a DataOutput stream. */
52: public void writeInfo(DataOutput dout) throws java.io.IOException {
53: dout.writeShort(u2NumberOfEntries);
54: for (int i = 0; i < u2NumberOfEntries; i++) {
55: entries[i].write(dout);
56: }
57: }
58:
59: }
|