@Override public long readLong(long pos) throws IOException { slice.seek(pos); return slice.readLong(); }
@Override public byte readByte(long pos) throws IOException { slice.seek(pos); return slice.readByte(); }
private void advanceBlock(int targetBlock) throws IOException { do { slice.seek(blockEnd); readBlockHeader(); } while (block < targetBlock); }
@Override public BytesRef binaryValue() throws IOException { bytesSlice.seek((long) doc * length); bytesSlice.readBytes(bytes.bytes, 0, length); return bytes; } };
@Override public short readShort(long pos) throws IOException { slice.seek(pos); return slice.readShort(); }
@Override public int nextDoc() throws IOException { if (++docIt >= upto) return DocIdSetIterator.NO_MORE_DOCS; postingInput.seek(offsets[docIt]); currFreq = postingInput.readVInt(); // reset variables used in nextPosition pos = 0; endOffset = 0; return docs[docIt]; }
/** Seeks the skip entry on the given level */ protected void seekChild(int level) throws IOException { skipStream[level].seek(lastChildPointer); numSkipped[level] = numSkipped[level + 1] - skipInterval[level + 1]; skipDoc[level] = lastDoc; if (level > 0) { childPointer[level] = skipStream[level].readVLong() + skipPointer[level - 1]; } }
@Override public int readInt(long pos) throws IOException { slice.seek(pos); return slice.readInt(); }
@Override protected void readInternal(byte[] b, int offset, int len) throws IOException { long start = getFilePointer(); if (start + len > length) { throw new EOFException("read past EOF: " + this); } base.seek(fileOffset + start); base.readBytes(b, offset, len, false); }
@Override public BytesRef binaryValue() throws IOException { bytesSlice.seek((long) disi.index() * length); bytesSlice.readBytes(bytes.bytes, 0, length); return bytes; } };
@Override public BytesRef binaryValue() throws IOException { long startOffset = addresses.get(doc); bytes.length = (int) (addresses.get(doc + 1L) - startOffset); bytesSlice.seek(startOffset); bytesSlice.readBytes(bytes.bytes, 0, bytes.length); return bytes; } };
int readDocIDs(IndexInput in, long blockFP, int[] docIDs) throws IOException { in.seek(blockFP); // How many points are stored in this leaf cell: int count = in.readVInt(); if (version < BKDWriter.VERSION_COMPRESSED_DOC_IDS) { DocIdsWriter.readInts32(in, count, docIDs); } else { DocIdsWriter.readInts(in, count, docIDs); } return count; }
private BytesRef getTermFromIndex(long index) throws IOException { assert index >= 0 && index <= (entry.termsDictSize - 1) >>> entry.termsDictIndexShift; final long start = indexAddresses.get(index); term.length = (int) (indexAddresses.get(index + 1) - start); indexBytes.seek(start); indexBytes.readBytes(term.bytes, 0, term.length); return term; }
private BytesRef getFirstTermFromBlock(long block) throws IOException { assert block >= 0 && block <= (entry.termsDictSize - 1) >>> entry.termsDictBlockShift; final long blockAddress = blockAddresses.get(block); bytes.seek(blockAddress); term.length = bytes.readVInt(); bytes.readBytes(term.bytes, 0, term.length); return term; }
private void visitDocIDs(IndexInput in, long blockFP, IntersectVisitor visitor) throws IOException { // Leaf node in.seek(blockFP); // How many points are stored in this leaf cell: int count = in.readVInt(); // No need to call grow(), it has been called up-front if (version < BKDWriter.VERSION_COMPRESSED_DOC_IDS) { DocIdsWriter.readInts32(in, count, visitor); } else { DocIdsWriter.readInts(in, count, visitor); } }
public MergeReader(BKDReader bkd, MergeState.DocMap docMap) throws IOException { this.bkd = bkd; state = new BKDReader.IntersectState(bkd.in.clone(), bkd.numDataDims, bkd.packedBytesLength, bkd.packedIndexBytesLength, bkd.maxPointsInLeafNode, null, null); this.docMap = docMap; state.in.seek(bkd.getMinLeafBlockFP()); this.packedValues = new byte[bkd.maxPointsInLeafNode * bkd.packedBytesLength]; }
@Override public BytesRef binaryValue() throws IOException { final int index = disi.index(); long startOffset = addresses.get(index); bytes.length = (int) (addresses.get(index + 1L) - startOffset); bytesSlice.seek(startOffset); bytesSlice.readBytes(bytes.bytes, 0, bytes.length); return bytes; } };
SerializedDocument document(int docID) throws IOException { if (state.contains(docID) == false) { fieldsStream.seek(indexReader.getStartPointer(docID)); state.reset(docID); } assert state.contains(docID); return state.document(docID); }
/** * Returns (but does not validate) the checksum previously written by {@link #checkFooter}. * @return actual checksum value * @throws IOException if the footer is invalid */ public static long retrieveChecksum(IndexInput in) throws IOException { if (in.length() < footerLength()) { throw new CorruptIndexException("misplaced codec footer (file truncated?): length=" + in.length() + " but footerLength==" + footerLength(), in); } in.seek(in.length() - footerLength()); validateFooter(in); return readCRC(in); }