use of org.locationtech.geowave.core.store.flatten.BitmaskedPairComparator in project geowave by locationtech.
the class BaseDataStoreUtils method combineValues.
private static byte[] combineValues(final List<Pair<Integer, FieldInfo<?>>> fieldInfoList) {
int totalLength = 0;
Collections.sort(fieldInfoList, new BitmaskedPairComparator());
final List<byte[]> fieldInfoBytesList = new ArrayList<>(fieldInfoList.size());
for (final Pair<Integer, FieldInfo<?>> fieldInfoPair : fieldInfoList) {
final FieldInfo<?> fieldInfo = fieldInfoPair.getRight();
final ByteBuffer fieldInfoBytes = ByteBuffer.allocate(VarintUtils.unsignedIntByteLength(fieldInfo.getWrittenValue().length) + fieldInfo.getWrittenValue().length);
VarintUtils.writeUnsignedInt(fieldInfo.getWrittenValue().length, fieldInfoBytes);
fieldInfoBytes.put(fieldInfo.getWrittenValue());
fieldInfoBytesList.add(fieldInfoBytes.array());
totalLength += fieldInfoBytes.array().length;
}
final ByteBuffer allFields = ByteBuffer.allocate(totalLength);
for (final byte[] bytes : fieldInfoBytesList) {
allFields.put(bytes);
}
return allFields.array();
}
Aggregations