private Edges edges(long chunkPtr) throws DhtException { if (isInCurrentChunk(chunkPtr)) { int type = typeOf(chunkPtr); Edges s = openEdges[type]; if (s == null) { s = new Edges(); openEdges[type] = s; } return s; } else { ChunkKey key = chunkOf(chunkPtr); Edges s = chunkEdges.get(key); if (s == null) { s = new Edges(); chunkEdges.put(key, s); } return s; } }
private Edges edges(long chunkPtr) throws DhtException { if (isInCurrentChunk(chunkPtr)) { int type = typeOf(chunkPtr); Edges s = openEdges[type]; if (s == null) { s = new Edges(); openEdges[type] = s; } return s; } else { ChunkKey key = chunkOf(chunkPtr); Edges s = chunkEdges.get(key); if (s == null) { s = new Edges(); chunkEdges.put(key, s); } return s; } }
@Override protected void onBeginOfsDelta(long deltaPos, long basePos, long inflatedSize) throws IOException { long basePtr = objChunkPtrs.get(findStreamIndex(basePos)); int type = typeOf(basePtr); currType = type; currPackedSize = 0; currInflatedSize = inflatedSize; currBasePtr = basePtr; objStreamPos.add(deltaPos); ChunkFormatter w = begin(type); if (isInCurrentChunk(basePtr)) { if (w.ofsDelta(inflatedSize, w.position() - offsetOf(basePtr))) { currDataPos = w.position(); return; } endChunk(type); w = begin(type); } if (!longOfsDelta(w, inflatedSize, basePtr)) { endChunk(type); w = begin(type); if (!longOfsDelta(w, inflatedSize, basePtr)) throw panicCannotInsert(); } currDataPos = w.position(); }
@Override protected void onBeginOfsDelta(long deltaPos, long basePos, long inflatedSize) throws IOException { long basePtr = objChunkPtrs.get(findStreamIndex(basePos)); int type = typeOf(basePtr); currType = type; currPackedSize = 0; currInflatedSize = inflatedSize; currBasePtr = basePtr; objStreamPos.add(deltaPos); ChunkFormatter w = begin(type); if (isInCurrentChunk(basePtr)) { if (w.ofsDelta(inflatedSize, w.position() - offsetOf(basePtr))) { currDataPos = w.position(); return; } endChunk(type); w = begin(type); } if (!longOfsDelta(w, inflatedSize, basePtr)) { endChunk(type); w = begin(type); if (!longOfsDelta(w, inflatedSize, basePtr)) throw panicCannotInsert(); } currDataPos = w.position(); }