public class StaticFieldComponentRead extends ComponentRead {
public Component load(CapInputStream in) throws UnableToReadCapFileException {
StaticFieldComponent staticFieldComponent = new StaticFieldComponent();
super.load((byte) ComponentEnum.STATIC_FIELD_COMPONENT.getValue(), in, staticFieldComponent);
// we reset the count of byte read to zero
in.resetCount();
staticFieldComponent.setImageSize(in.readShort());
staticFieldComponent.setReferenceCount(in.readShort());
staticFieldComponent.setArrayInitCount(in.readShort());
staticFieldComponent.setArrayInit(new ArrayList<ArrayInitInfo>(staticFieldComponent.getArrayInitCount()));
for (int i = 0; i < staticFieldComponent.getArrayInitCount(); i++) {
ArrayInitInfo ar = new ArrayInitInfoRead().load(in);
staticFieldComponent.getArrayInit().add(ar);
}
staticFieldComponent.setDefaultValueCount(in.readShort());
staticFieldComponent.setNonDefaultValueCount(in.readShort());
staticFieldComponent.setNonDefaultValues(new ArrayList<Byte>(staticFieldComponent.getNonDefaultValueCount()));
for (int i = 0; i < staticFieldComponent.getNonDefaultValueCount(); i++) {
staticFieldComponent.getNonDefaultValues().add(in.readByte());
}
checkSize(in, staticFieldComponent);
return staticFieldComponent;