public class ImportComponentRead extends ComponentRead {
@Override
public Component load(CapInputStream in) throws UnableToReadCapFileException {
ImportComponent importComponent = new ImportComponent();
//we first read tag and size
super.load((byte) ComponentEnum.IMPORT_COMPONENT.getValue(), in, importComponent);
//we reset the count of byte read to zero
in.resetCount();
//count reading
importComponent.setCount(in.readByte());
importComponent.setPackages(new ArrayList<PackageInfo>());
//packages reading
for (int i = 0; i < importComponent.getCount(); i++) {
PackageInfo pInf = new PackageInfoRead().load(in);
importComponent.getPackages().add(pInf);
}
checkSize(in, importComponent);
return importComponent;