if (tFieldTypes[i] == null) {
size += 1;
} else if (tFieldTypes[i].typeClass().hasFixedSerializationSize()) {
size += tFieldTypes[i].typeClass().fixedSerializationSize() + 2;
} else {
ValueSource src = row.value(i);
if (!src.isNull()) {
switch (TInstance.underlyingType(src.getType())) {
case STRING:
size += AkCollator.getDebugString(src, collators[i]).length() * 2 + 3;
break;
case BYTES:
size += src.getBytes().length;
break;
default:
throw new IllegalArgumentException("Unexpected UnderlyingType: " + src.getType());
}
} else {
size += 1;
}
}
}
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);
}
}