1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /* 6 * Licensed to the Apache Software Foundation (ASF) under one or more 7 * contributor license agreements. See the NOTICE file distributed with 8 * this work for additional information regarding copyright ownership. 9 * The ASF licenses this file to You under the Apache License, Version 2.0 10 * (the "License"); you may not use this file except in compliance with 11 * the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 */ 21 22 package com.sun.org.apache.bcel.internal.classfile; 23 24 /** 25 * Unknown (non-standard) attributes may be read via user-defined factory 26 * objects that can be registered with the Attribute.addAttributeReader 27 * method. These factory objects should implement this interface. 28 * 29 * @see Attribute 30 * @version $Id$ 31 * @since 6.0 32 */ 33 public interface UnknownAttributeReader { 34 35 /** 36 * When this attribute reader is added via the static method Attribute.addAttributeReader, 37 * an attribute name is associated with it. As the class file parser parses attributes, 38 * it will call various AttributeReaders based on the name of the attributes it is constructing. 39 * 40 * @param name_index An index into the constant pool, indexing a ConstantUtf8 41 * that represents the name of the attribute. 42 * @param length The length of the data contained in the attribute. This is written 43 * into the constant pool and should agree with what the factory expects the length to be. 44 * @param file This is the data input that the factory needs to read its data from. 45 * @param constant_pool This is the constant pool associated with the Attribute that we are constructing. 46 * 47 * @return The user-defined AttributeReader should take this data and use 48 * it to construct an attribute. In the case of errors, a null can be 49 * returned which will cause the parsing of the class file to fail. 50 * 51 * @see Attribute#addAttributeReader(String, UnknownAttributeReader) 52 */ 53 Attribute createAttribute( int name_index, int length, java.io.DataInput file, ConstantPool constant_pool ); 54 }