use of com.google.common.io.OutputSupplier in project druid by druid-io.
the class StringDimensionMergerLegacy method writeIndexesToFiles.
@Override
public void writeIndexesToFiles(final ByteSink invertedIndexFile, final OutputSupplier<FileOutputStream> spatialIndexFile) throws IOException {
final SerializerUtils serializerUtils = new SerializerUtils();
final OutputSupplier<OutputStream> invertedIndexOutputSupplier = new OutputSupplier<OutputStream>() {
@Override
public OutputStream getOutput() throws IOException {
return invertedIndexFile.openStream();
}
};
bitmapWriter.close();
serializerUtils.writeString(invertedIndexOutputSupplier, dimensionName);
ByteStreams.copy(bitmapWriter.combineStreams(), invertedIndexOutputSupplier);
if (capabilities.hasSpatialIndexes()) {
spatialWriter.close();
serializerUtils.writeString(spatialIndexFile, dimensionName);
ByteStreams.copy(spatialWriter.combineStreams(), spatialIndexFile);
}
}
Aggregations