1 21 22 package org.apache.derby.iapi.services.classfile; 23 24 import java.io.IOException ; 25 26 class AttributeEntry { 27 28 private int attribute_name_index; 29 private ClassFormatOutput infoOut; 30 byte[] infoIn; 31 32 AttributeEntry(int name_index, ClassFormatOutput info) { 33 super(); 34 35 attribute_name_index = name_index; 36 this.infoOut = info; 37 } 38 39 40 AttributeEntry(ClassInput in) throws IOException { 41 attribute_name_index = in.getU2(); 42 infoIn = in.getU1Array(in.getU4()); 43 } 44 45 int getNameIndex() { return attribute_name_index; } 46 47 void put(ClassFormatOutput out) throws IOException { 48 out.putU2(attribute_name_index); 49 if (infoOut != null) { 50 out.putU4(infoOut.size()); 51 infoOut.writeTo(out); 52 } else { 53 out.putU4(infoIn.length); 54 out.write(infoIn); 55 } 56 } 57 58 61 int classFileSize() { 62 return 2 + 4 + 63 ((infoOut != null) ? infoOut.size() : infoIn.length); 64 } 65 } 66 | Popular Tags |