Search in sources :

Example 1 with OutputSupplier

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);
    }
}
Also used : FileOutputSupplier(io.druid.common.guava.FileOutputSupplier) OutputSupplier(com.google.common.io.OutputSupplier) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) SerializerUtils(io.druid.common.utils.SerializerUtils)

Aggregations

OutputSupplier (com.google.common.io.OutputSupplier)1 FileOutputSupplier (io.druid.common.guava.FileOutputSupplier)1 SerializerUtils (io.druid.common.utils.SerializerUtils)1 FileOutputStream (java.io.FileOutputStream)1 OutputStream (java.io.OutputStream)1