@Override protected void onBeginWholeObject(long streamPosition, int type, long inflatedSize) throws IOException { ChunkFormatter w = begin(type); if (!w.whole(type, inflatedSize)) { endChunk(type); w = begin(type); if (!w.whole(type, inflatedSize)) throw panicCannotInsert(); } currType = type; currDataPos = w.position(); currPackedSize = 0; currInflatedSize = inflatedSize; objStreamPos.add(streamPosition); }
@Override protected void onBeginWholeObject(long streamPosition, int type, long inflatedSize) throws IOException { ChunkFormatter w = begin(type); if (!w.whole(type, inflatedSize)) { endChunk(type); w = begin(type); if (!w.whole(type, inflatedSize)) throw panicCannotInsert(); } currType = type; currDataPos = w.position(); currPackedSize = 0; currInflatedSize = inflatedSize; objStreamPos.add(streamPosition); }
w.adjustObjectCount(1, typeOld); if (!w.append(dataOld, hdrPos, hdrLen)) throw panicCannotInsert(); break; throw panicCannotInsert(); break; throw panicCannotInsert(); dataOld = null;
w.adjustObjectCount(1, typeOld); if (!w.append(dataOld, hdrPos, hdrLen)) throw panicCannotInsert(); break; throw panicCannotInsert(); break; throw panicCannotInsert(); dataOld = null;
@Override protected void onBeginRefDelta(long deltaPos, AnyObjectId baseId, long inflatedSize) throws IOException { // Try to get the base type, but only if it was seen before in this // pack stream. If not assume worst-case of BLOB type. // int typeCode; DhtInfo baseInfo = objectMap.get(baseId); if (baseInfo != null && baseInfo.isInPack()) { typeCode = baseInfo.getType(); currType = typeCode; } else { typeCode = OBJ_BLOB; currType = -1; } ChunkFormatter w = begin(typeCode); if (!w.refDelta(inflatedSize, baseId)) { endChunk(typeCode); w = begin(typeCode); if (!w.refDelta(inflatedSize, baseId)) throw panicCannotInsert(); } currDataPos = w.position(); currPackedSize = 0; currInflatedSize = inflatedSize; objStreamPos.add(deltaPos); }
@Override protected void onBeginRefDelta(long deltaPos, AnyObjectId baseId, long inflatedSize) throws IOException { // Try to get the base type, but only if it was seen before in this // pack stream. If not assume worst-case of BLOB type. // int typeCode; DhtInfo baseInfo = objectMap.get(baseId); if (baseInfo != null && baseInfo.isInPack()) { typeCode = baseInfo.getType(); currType = typeCode; } else { typeCode = OBJ_BLOB; currType = -1; } ChunkFormatter w = begin(typeCode); if (!w.refDelta(inflatedSize, baseId)) { endChunk(typeCode); w = begin(typeCode); if (!w.refDelta(inflatedSize, baseId)) throw panicCannotInsert(); } currDataPos = w.position(); currPackedSize = 0; currInflatedSize = inflatedSize; objStreamPos.add(deltaPos); }
@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(); }