* @throws fr.xlim.ssd.capmanipulator.library.exceptions.UnableToReadCapFileException
*
*/
public FieldDescriptorInfo load(CapInputStream in) throws UnableToReadCapFileException {
FieldDescriptorInfo fieldDescriptorInfo = new FieldDescriptorInfo();
fieldDescriptorInfo.setToken(in.readByte()); // Token reading
fieldDescriptorInfo.setAccesFlags(in.readByte()); // Access flag reading
if ((fieldDescriptorInfo.getAccesFlags() & FieldDescriptorInfo.ACC_STATIC) >>> 3 == 1) {
//the field is a Static Field
StaticField fieldRef = new StaticField();
fieldDescriptorInfo.setFieldRef(fieldRef);
StaticFieldRef sFieldRef = new StaticFieldRefRead().load(in);
((StaticField) fieldRef).setStaticField(sFieldRef);
} else {
//the fied is an instance field
ClassRef classref = new ClassRefRead().load(in);
byte tok = in.readByte();
FieldRef fieldRef = new InstanceField();
fieldDescriptorInfo.setFieldRef(fieldRef);
((InstanceField) fieldRef).setClass_(classref);
((InstanceField) fieldRef).setToken(tok);
}
fieldDescriptorInfo.setType(in.readShort()); // Type reading
return fieldDescriptorInfo;
}