1    
2    package attr;
3    
4    import java.io.*;
5    import util.*;
6    import jconst.*;
7    
8    /**
9       <p>
10      Base class for attributes (Section 4.7, JVM Specification).  All
11      other attributes are derived from this class.  The attributes
12      in (Java 1.2) are:
13   
14      <ul>
15      <li>
16      <p>
17      constant attribute
18      </li>
19      <li>
20      <p>
21      code attribute
22      </li>
23      <li>
24      <p>
25      exceptions attribute
26      </li>
27      <li>
28      <p>
29      inner classes attribute   
30      </li>
31      <li>
32      <p>
33      synthetic attribute
34      </li>
35      <li>
36      <p>
37      source file attribute
38      </li>
39      <li>
40      <p>
41      line number table attribute
42      </li>
43      <li>
44      <p>
45      Local variable table attribute
46      </li>
47      <li>
48      <p>
49      deprecated attribute
50      </li>
51      </ul>
52   
53      <p>
54       All attributes have a  CONSTANT_Utf8_info entry and a length.
55       There may be attributes which are unknown.  The data in these
56       attributes (length bytes following the length field) is 
57       skipped.
58   
59       <p>
60       The structure of the base class is:
61   
62   <pre>
63       attrInfo {
64         u2 attr_name_index;
65         u4 length;
66       }
67   
68       @author Ian Kaplan
69   </pre>
70   
71    */
72   public class attrInfo extends dataRead {
73     String attrName = null;
74     int len = 0;
75   
76     attrInfo( String name, int length ) {
77       attrName = name;
78       len = length;
79     } // attrInfo
80   
81   
82     public String getName() { return attrName; }
83   
84   
85     public void pr() {
86       if (attrName != null) {
87         System.out.print(attrName + ": len = " + len );
88       }
89     } // pr
90   
91   } // attrInfo
92