package org.apache.bcel.classfile; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import org.apache.bcel.Constants; /** * * @author dorina * */ public class ExternalFieldsAttribute extends Attribute{ /** * */ private static final long serialVersionUID = -3137502604828533407L; byte []externalFields; public ExternalFieldsAttribute(int name_index, int length, byte[] externalFields, ConstantPool cp) { super(Constants.ATTR_EXTERNAL_FIELDS, name_index,length, cp); this.externalFields = externalFields; } public ExternalFieldsAttribute(int name_index, int length, DataInputStream str, ConstantPool cp) throws IOException { this(name_index, length, (byte [])null, cp); if( length > 0) { externalFields = new byte[length]; for(int i = 0; i < length; i++) { externalFields[i] = str.readByte(); } } } /* (non-Javadoc) * @see org.apache.bcel.classfile.Attribute#accept(org.apache.bcel.classfile.Visitor) */ public void accept(Visitor v) { // TODO Auto-generated method stub } /* (non-Javadoc) * @see org.apache.bcel.classfile.Attribute#copy(org.apache.bcel.classfile.ConstantPool) */ public Attribute copy(ConstantPool constant_pool) { ExternalFieldsAttribute copy = (ExternalFieldsAttribute)clone(); System.arraycopy(externalFields,0,copy.externalFields,0,externalFields.length); return copy; } public final void dump(DataOutputStream file) throws IOException { super.dump(file); for(int i = 0; i < externalFields.length; i++) { file.writeByte(externalFields[i]); } } }