public class ReferenceLocationComponentRead extends ComponentRead {
@Override
public Component load(CapInputStream in) throws UnableToReadCapFileException {
ReferenceLocationComponent referenceLocationComponent = new ReferenceLocationComponent();
super.load((byte) ComponentEnum.REFERENCE_LOCATION_COMPONENT.getValue(), in, referenceLocationComponent);
// we reset the count of byte read to zero
in.resetCount();
referenceLocationComponent.setByteIndexCount(in.readShort());
referenceLocationComponent.setOffsetsToByteIndices(new ArrayList<Byte>(referenceLocationComponent.getByteIndexCount()));
for (int i = 0; i < referenceLocationComponent.getByteIndexCount(); i++) {
referenceLocationComponent.getOffsetsToByteIndices().add(in.readByte());
}
referenceLocationComponent.setByte2IndexCount(in.readShort());
referenceLocationComponent.setOffsetsToByte2Indices(new ArrayList<Byte>(referenceLocationComponent.getByte2IndexCount()));
for (int i = 0; i < referenceLocationComponent.getByte2IndexCount(); i++) {
referenceLocationComponent.getOffsetsToByte2Indices().add(in.readByte());
}
checkSize(in, referenceLocationComponent);
return referenceLocationComponent;