1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.bcel.classfile;
18
19 /***
20 * Unknown (non-standard) attributes may be read via user-defined factory
21 * objects that can be registered with the Attribute.addAttributeReader
22 * method. These factory objects should implement this interface.
23
24 * @see Attribute
25 * @version $Id: AttributeReader.java 386056 2006-03-15 11:31:56Z tcurdt $
26 * @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
27 */
28 public interface AttributeReader {
29
30 /***
31 When this attribute reader is added via the static method
32 Attribute.addAttributeReader, an attribute name is associated with it.
33 As the class file parser parses attributes, it will call various
34 AttributeReaders based on the name of the attributes it is
35 constructing.
36
37 @param name_index An index into the constant pool, indexing a
38 ConstantUtf8 that represents the name of the attribute.
39
40 @param length The length of the data contained in the attribute. This
41 is written into the constant pool and should agree with what the
42 factory expects the length to be.
43
44 @param file This is the data input stream that the factory needs to read
45 its data from.
46
47 @param constant_pool This is the constant pool associated with the
48 Attribute that we are constructing.
49
50 @return The user-defined AttributeReader should take this data and use
51 it to construct an attribute. In the case of errors, a null can be
52 returned which will cause the parsing of the class file to fail.
53
54 @see Attribute#addAttributeReader( String, AttributeReader )
55 */
56 public Attribute createAttribute( int name_index, int length, java.io.DataInputStream file,
57 ConstantPool constant_pool );
58 }