}
}
size = ((size + SIZE_GRANULARITY - 1) / SIZE_GRANULARITY) * SIZE_GRANULARITY;
// Create a new conversion value
Value convertValue = new Value ((Persistit)null,
Math.max(size, Value.INITIAL_SIZE),
Math.max(size, Value.DEFAULT_MAXIMUM_SIZE));
valueTarget.attach(convertValue);
// Covert the row to the Value for storage in the SortKey
while(true) {
try {
convertValue.clear();
convertValue.setStreamMode(true);
for (int i = 0; i < rowFields; i++) {
ValueSource field = row.value(i);
if (field.isNull()) {
valueTarget.putNull();
} else {
tFieldTypes[i].writeCanonical(field, valueTarget);
}
}
break;
} catch (ConversionException e) {
enlargeValue(convertValue);
}
}
// reset some more un-needed internal state. But this requires
// making a copy of the internal data, again.
return new Value(convertValue);
}