final FieldInfo fieldInfo, final ClassInfo fieldType)
throws ObjectIOException, ObjectIODataRecordNotFoundException,
ObjectIOClassNotFoundException, ObjectIOInvalidClassException,
ObjectIODataCorruptedException, ObjectIONotSerializableException {
int offset = beginOffset;
final ObjectClassInfoAndDeclared fieldValueClassInfoAndDeclared;
if (logger.debugEnabled) {
logger.debug("read field at offset " + offset);
}
if (fieldInfo.isPersisted()) {
if (fieldType.isBasicOrPrimitiveType()) {
AbstractConverter binaryConverter;
try {
binaryConverter = helperBinaryConversion.fromBinary(binary,
offset, fieldType);
} catch (BinaryConverterException exception) {
throw new ObjectIOException(exception);
}
final Object fieldValue = binaryConverter.objectFromBinary;
binaryConverter.objectFromBinary = null;// NOPMD
try {
final ObjectAndPersistInfo fieldAndPersistInfo = objectIOManager
.createObjectPersistInfoOfObject(
fieldValue,
Boolean.FALSE,
fieldValue == null ? ClassInfo.NULL
: classInfoFactory
.getNoProxyClassInfo(fieldValue
.getClass()), false);
fieldValueClassInfoAndDeclared = new ObjectClassInfoAndDeclared(
fieldAndPersistInfo, fieldType);
} catch (ClassInfoException exception) {
throw new ObjectIOException(exception);
}
offset += fieldType.getBinarySize();
} else {
final ObjectAndPersistInfo fromReference = referenceInput
.fromBinary(binary, offset);
offset += HelperBinaryConversion.REFERENCE_NULLABLE_BYTE_SIZE;
fieldValueClassInfoAndDeclared = new ObjectClassInfoAndDeclared(
fromReference, fieldType/* declared type */);
}
} else {
fieldValueClassInfoAndDeclared = ObjectClassInfoAndDeclared.NULL;
}
addSonReadObject(objectAndPersistInfo, fieldValueClassInfoAndDeclared);
values[index] = fieldValueClassInfoAndDeclared;
if (logger.debugEnabled) {
logger.debug("read field " + fieldInfo.getFieldName() + " is null="
+ (fieldValueClassInfoAndDeclared.getObject() == null));
}
return offset;
}