Class BitmapInvertedIndexWriter

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public final class BitmapInvertedIndexWriter
    extends Object
    implements Closeable
    Writer for bitmap inverted index file.
     Layout for RoaringBitmap inverted index:
     |-------------------------------------------------------------------------|
     |                    Start offset of 1st bitmap                           |
     |    End offset of 1st bitmap (exclusive) / Start offset of 2nd bitmap    |
     |                                   ...                                   |
     | End offset of 2nd last bitmap (exclusive) / Start offset of last bitmap |
     |                  End offset of last bitmap (exclusive)                  |
     |-------------------------------------------------------------------------|
     |                           Data for 1st bitmap                           |
     |                           Data for 2nd bitmap                           |
     |                                   ...                                   |
     |                           Data for last bitmap                          |
     |-------------------------------------------------------------------------|
     
    • Constructor Detail

      • BitmapInvertedIndexWriter

        public BitmapInvertedIndexWriter​(File outputFile,
                                         int numBitmaps)
                                  throws IOException
        Throws:
        IOException
      • BitmapInvertedIndexWriter

        public BitmapInvertedIndexWriter​(FileChannel fileChannel,
                                         int numBitmaps,
                                         boolean ownsChannel)
                                  throws IOException
        Creates a new writer that uses the given FileChannel. It will start to write on the current position of the channel assuming it is the last useful byte in the file. When this object is closed, the channel is truncated to the last byte written by this writer.
        Parameters:
        fileChannel - the file channel to be used
        numBitmaps - the number of bitmaps that are expected. The actual value cannot be higher than this value. Fewer bitmaps than the given value can be used, but in that case the representation will not be as expected.
        ownsChannel - whether this writer owns the channel or not. If the channel is owned then it will be closed when this object is closed. Otherwise the owner will have to close it by itself. Even if this writer does not own the channel, it will be truncated when the writer is closed.
        Throws:
        IOException