public final static int MAX_STORAGE_SIZE_CAP = 1024 * 1024 - 1024;
public long computeStorageSize(boolean average) {
TClass tclass = TInstance.tClass(type);
if (tclass.hasFixedSerializationSize(type)) {
return tclass.fixedSerializationSize(type);
}
else {
long maxBytes = tclass.variableSerializationSize(type, average);
return Math.min(MAX_STORAGE_SIZE_CAP, maxBytes) + prefixSize(maxBytes);
}