private NodBlockReader(final IndexInput in) { super(in); // ensure that the output buffers has the minimum size required nodLenBuffer = ArrayUtils.grow(nodLenBuffer, nodDecompressor.getWindowSize()); nodBuffer = ArrayUtils.grow(nodBuffer, nodDecompressor.getWindowSize()); termFreqBuffer = ArrayUtils.grow(termFreqBuffer, nodDecompressor.getWindowSize()); }
@Override protected void readHeader() throws IOException { // logger.debug("Read Nod header: {}", this.hashCode()); // logger.debug("Nod header start at {}", in.getFilePointer()); // read blockSize and check buffer size nodLenBlockSize = in.readVInt(); // ensure that the output buffer has the minimum size required final int nodLenBufferLength = this.getMinimumBufferSize(nodLenBlockSize, nodDecompressor.getWindowSize()); nodLenBuffer = ArrayUtils.grow(nodLenBuffer, nodLenBufferLength); // logger.debug("Read Nod length block size: {}", nodLenblockSize); nodBlockSize = in.readVInt(); // ensure that the output buffer has the minimum size required final int nodBufferLength = this.getMinimumBufferSize(nodBlockSize, nodDecompressor.getWindowSize()); nodBuffer = ArrayUtils.grow(nodBuffer, nodBufferLength); // logger.debug("Read Nod block size: {}", nodBlockSize); termFreqBlockSize = in.readVInt(); // ensure that the output buffer has the minimum size required final int termFreqBufferLength = this.getMinimumBufferSize(termFreqBlockSize, nodDecompressor.getWindowSize()); termFreqBuffer = ArrayUtils.grow(termFreqBuffer, termFreqBufferLength); // logger.debug("Read Term Freq In Node block size: {}", termFreqblockSize); // read size of each compressed data block and check buffer size nodLenCompressedBufferLength = in.readVInt(); nodLenCompressedBuffer = ArrayUtils.grow(nodLenCompressedBuffer, nodLenCompressedBufferLength); nodLenReadPending = true; nodCompressedBufferLength = in.readVInt(); nodCompressedBuffer = ArrayUtils.grow(nodCompressedBuffer, nodCompressedBufferLength); nodReadPending = true; termFreqCompressedBufferLength = in.readVInt(); termFreqCompressedBuffer = ArrayUtils.grow(termFreqCompressedBuffer, termFreqCompressedBufferLength); termFreqReadPending = true; // decode node lengths this.decodeNodeLengths(); // copy reference of node buffer currentNode.ints = nodBuffer.ints; }