private void writeMultiLevelIndex(List<IndexEntry> keys) throws IOException { levels = 1; while (maxIndexLevels == 0 || levels < maxIndexLevels) { keys = writeOneLevel(keys); if (keys == null) { return; } levels++; } // When maxIndexLevels has restricted the writer, write one // index block with the entire remaining set of keys. BlockWriter b = new BlockWriter( INDEX_BLOCK_TYPE, keyType, MAX_BLOCK_SIZE, Math.max(restartInterval, keys.size() / MAX_RESTARTS)); for (Entry e : keys) { b.mustAdd(e); } rootPosition = out.size(); b.writeTo(out); }
bytes += out.estimatePadBetweenBlocks(sz); bytes += idx.estimateBytes(curBlockPos);
private void writeMultiLevelIndex(List<IndexEntry> keys) throws IOException { levels = 1; while (maxIndexLevels == 0 || levels < maxIndexLevels) { keys = writeOneLevel(keys); if (keys == null) { return; } levels++; } // When maxIndexLevels has restricted the writer, write one // index block with the entire remaining set of keys. BlockWriter b = new BlockWriter( INDEX_BLOCK_TYPE, keyType, MAX_BLOCK_SIZE, Math.max(restartInterval, keys.size() / MAX_RESTARTS)); for (Entry e : keys) { b.mustAdd(e); } rootPosition = out.size(); b.writeTo(out); }
Section(byte keyType) { idx = new IndexBuilder(keyType); firstBlockPosition = out.size(); }
void writeIndex() throws IOException { if (padBetweenBlocks(keyType)) { out.padBetweenBlocksToNextBlock(); } long startPos = out.size(); writeMultiLevelIndex(entries); bytes = (int) (out.size() - startPos); entries = null; }
void finishSectionMaybeWriteIndex() throws IOException { flushCurBlock(); cur = null; if (shouldHaveIndex(idx)) { idx.writeIndex(); } bytes = out.size() - firstBlockPosition; } }
bytes += out.estimatePadBetweenBlocks(sz); bytes += idx.estimateBytes(curBlockPos);
Section(byte keyType) { idx = new IndexBuilder(keyType); firstBlockPosition = out.size(); }
void writeIndex() throws IOException { if (padBetweenBlocks(keyType)) { out.padBetweenBlocksToNextBlock(); } long startPos = out.size(); writeMultiLevelIndex(entries); bytes = (int) (out.size() - startPos); entries = null; }
void finishSectionMaybeWriteIndex() throws IOException { flushCurBlock(); cur = null; if (shouldHaveIndex(idx)) { idx.writeIndex(); } bytes = out.size() - firstBlockPosition; } }