1 11 package org.eclipse.jdt.internal.core.util; 12 13 import org.eclipse.jdt.core.util.ClassFormatException; 14 import org.eclipse.jdt.core.util.IConstantPool; 15 import org.eclipse.jdt.core.util.IInnerClassesAttribute; 16 import org.eclipse.jdt.core.util.IInnerClassesAttributeEntry; 17 18 21 public class InnerClassesAttribute extends ClassFileAttribute implements IInnerClassesAttribute { 22 private static final IInnerClassesAttributeEntry[] NO_ENTRIES = new IInnerClassesAttributeEntry[0]; 23 24 private int numberOfClasses; 25 private IInnerClassesAttributeEntry[] entries; 26 33 public InnerClassesAttribute( 34 byte[] classFileBytes, 35 IConstantPool constantPool, 36 int offset) 37 throws ClassFormatException { 38 super(classFileBytes, constantPool, offset); 39 this.numberOfClasses = u2At(classFileBytes, 6, offset); 40 final int length = this.numberOfClasses; 41 if (length != 0) { 42 int readOffset = 8; 43 this.entries = new IInnerClassesAttributeEntry[length]; 44 for (int i = 0; i < length; i++) { 45 this.entries[i] = new InnerClassesAttributeEntry(classFileBytes, constantPool, offset + readOffset); 46 readOffset += 8; 47 } 48 } else { 49 this.entries = NO_ENTRIES; 50 } 51 } 52 53 56 public IInnerClassesAttributeEntry[] getInnerClassAttributesEntries() { 57 return this.entries; 58 } 59 60 63 public int getNumberOfClasses() { 64 return this.numberOfClasses; 65 } 66 67 } 68 | Popular Tags |