Class FixedByteChunkForwardIndexWriter

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    @NotThreadSafe
    public class FixedByteChunkForwardIndexWriter
    extends BaseChunkForwardIndexWriter
    Chunk-based raw (non-dictionary-encoded) forward index writer where each chunk contains fixed number of docs, and each entry has fixed number of bytes.
    • Constructor Detail

      • FixedByteChunkForwardIndexWriter

        public FixedByteChunkForwardIndexWriter​(File file,
                                                ChunkCompressionType compressionType,
                                                int totalDocs,
                                                int numDocsPerChunk,
                                                int sizeOfEntry,
                                                int writerVersion)
                                         throws IOException
        Constructor for the class.
        Parameters:
        file - File to write to.
        compressionType - Type of compression to use.
        totalDocs - Total number of docs to write.
        numDocsPerChunk - Number of documents per chunk.
        sizeOfEntry - Size of entry (in bytes)
        writerVersion - writer format version
        Throws:
        FileNotFoundException - Throws FileNotFoundException if the specified file is not found.
        IOException - Throws IOException if there are any errors mapping the underlying ByteBuffer.
    • Method Detail

      • putInt

        public void putInt​(int value)
      • putLong

        public void putLong​(long value)
      • putFloat

        public void putFloat​(float value)
      • putDouble

        public void putDouble​(double value)
      • writeChunk

        protected void writeChunk()
        Description copied from class: BaseChunkForwardIndexWriter
        Helper method to compress and write the current chunk.
        • Chunk header is of fixed size, so fills out any remaining offsets for partially filled chunks.
        • Compresses (if required) and writes the chunk to the data file.
        • Updates the header with the current chunks offset.
        • Clears up the buffers, so that they can be reused.
        Overrides:
        writeChunk in class BaseChunkForwardIndexWriter