public class DescriptorComponentRead extends ComponentRead {
@Override
public Component load(CapInputStream in) throws UnableToReadCapFileException {
DescriptorComponent descriptorComponent = new DescriptorComponent();
super.load((byte) ComponentEnum.DESCRIPTOR_COMPONENT.getValue(), in, descriptorComponent);
// we reset the count of byte read to zero
in.resetCount();
descriptorComponent.setClassCount(in.readByte());
descriptorComponent.setClasses(new ArrayList<ClassDescriptorInfo>(descriptorComponent.getClassCount()));
for (int i = 0; i < descriptorComponent.getClassCount(); i++) {
ClassDescriptorInfo cDes = new ClassDescriptorInfoRead().load(in);
descriptorComponent.getClasses().add(cDes);
}
TypeDescriptorInfo typeDescriptorInfo = new TypeDescriptorInfoRead().load(in, descriptorComponent);
descriptorComponent.setTypes(typeDescriptorInfo);
checkSize(in, descriptorComponent);
return descriptorComponent;
}