if (size < maxMemorySize) {
writeSmallBinary(out, blobVal, state, i);
} else {
out.writeInt(BINARY_IN_DATA_STORE);
try {
val.store(dataStore);
} catch (RepositoryException e) {
String msg = "Error while storing blob. id="
+ state.getId() + " idx=" + i + " size=" + val.getBLOBFileValue().getLength();
log.error(msg, e);
throw new IOException(msg);