void writeIndex() throws IOException { if (padBetweenBlocks(keyType)) { out.padBetweenBlocksToNextBlock(); } long startPos = out.size(); writeMultiLevelIndex(entries); bytes = (int) (out.size() - startPos); entries = null; }
private void writeObjBlocks() throws IOException { List<RefList> sorted = sortById(obj2ref); obj2ref = null; objIdLen = shortestUniqueAbbreviation(sorted); out.padBetweenBlocksToNextBlock(); objs = new Section(OBJ_BLOCK_TYPE); objs.entryCnt = sorted.size(); for (RefList l : sorted) { objs.write(new ObjEntry(objIdLen, l, l.blockPos)); } objs.finishSectionMaybeWriteIndex(); }
private List<IndexEntry> writeOneLevel(List<IndexEntry> keys) throws IOException { Section thisLevel = new Section(keyType); for (Entry e : keys) { thisLevel.write(e); } if (!thisLevel.idx.entries.isEmpty()) { thisLevel.flushCurBlock(); if (cur.padBetweenBlocks()) { out.padBetweenBlocksToNextBlock(); } cur = null; return thisLevel.idx.entries; } // The current block fit entire level; make it the root. rootPosition = out.size(); cur.writeTo(out); cur = null; return null; } }
long write(BlockWriter.Entry entry) throws IOException { if (cur == null) { beginBlock(entry); } else if (!cur.tryAdd(entry)) { flushCurBlock(); if (cur.padBetweenBlocks()) { out.padBetweenBlocksToNextBlock(); } beginBlock(entry); } entryCnt++; return out.size(); }
void writeIndex() throws IOException { if (padBetweenBlocks(keyType)) { out.padBetweenBlocksToNextBlock(); } long startPos = out.size(); writeMultiLevelIndex(entries); bytes = (int) (out.size() - startPos); entries = null; }
private void writeObjBlocks() throws IOException { List<RefList> sorted = sortById(obj2ref); obj2ref = null; objIdLen = shortestUniqueAbbreviation(sorted); out.padBetweenBlocksToNextBlock(); objs = new Section(OBJ_BLOCK_TYPE); objs.entryCnt = sorted.size(); for (RefList l : sorted) { objs.write(new ObjEntry(objIdLen, l, l.blockPos)); } objs.finishSectionMaybeWriteIndex(); }
private List<IndexEntry> writeOneLevel(List<IndexEntry> keys) throws IOException { Section thisLevel = new Section(keyType); for (Entry e : keys) { thisLevel.write(e); } if (!thisLevel.idx.entries.isEmpty()) { thisLevel.flushCurBlock(); if (cur.padBetweenBlocks()) { out.padBetweenBlocksToNextBlock(); } cur = null; return thisLevel.idx.entries; } // The current block fit entire level; make it the root. rootPosition = out.size(); cur.writeTo(out); cur = null; return null; } }
long write(BlockWriter.Entry entry) throws IOException { if (cur == null) { beginBlock(entry); } else if (!cur.tryAdd(entry)) { flushCurBlock(); if (cur.padBetweenBlocks()) { out.padBetweenBlocksToNextBlock(); } beginBlock(entry); } entryCnt++; return out.size(); }