/** * Compute the ObjectId for this tree * * @param ins a {@link org.eclipse.jgit.lib.ObjectInserter} object. * @return ObjectId for this tree */ public ObjectId computeId(ObjectInserter ins) { if (buf != null) return ins.idFor(OBJ_TREE, buf, 0, ptr); final long len = overflowBuffer.length(); try { return ins.idFor(OBJ_TREE, len, overflowBuffer.openInputStream()); } catch (IOException e) { // this should never happen throw new RuntimeException(e); } }
private void writeDeltaObjectDeflate(PackOutputStream out, final ObjectToPack otp) throws IOException { writeBase(out, otp.getDeltaBase()); crc32.reset(); otp.setOffset(out.length()); DeltaCache.Ref ref = otp.popCachedDelta(); if (ref != null) { byte[] zbuf = ref.get(); if (zbuf != null) { out.writeHeader(otp, otp.getCachedSize()); out.write(zbuf); typeStats.cntDeltas++; typeStats.deltaBytes += out.length() - otp.getOffset(); return; } } try (TemporaryBuffer.Heap delta = delta(otp)) { out.writeHeader(otp, delta.length()); Deflater deflater = deflater(); deflater.reset(); DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater); delta.writeTo(dst, null); dst.finish(); } typeStats.cntDeltas++; typeStats.deltaBytes += out.length() - otp.getOffset(); }
/** * Compute the ObjectId for this tree * * @param ins * @return ObjectId for this tree */ public ObjectId computeId(ObjectInserter ins) { if (buf != null) return ins.idFor(OBJ_TREE, buf, 0, ptr); final long len = overflowBuffer.length(); try { return ins.idFor(OBJ_TREE, len, overflowBuffer.openInputStream()); } catch (IOException e) { // this should never happen throw new RuntimeException(e); } }
private void writeDeltaObjectDeflate(PackOutputStream out, final ObjectToPack otp) throws IOException { writeBase(out, otp.getDeltaBase()); crc32.reset(); otp.setOffset(out.length()); DeltaCache.Ref ref = otp.popCachedDelta(); if (ref != null) { byte[] zbuf = ref.get(); if (zbuf != null) { out.writeHeader(otp, otp.getCachedSize()); out.write(zbuf); typeStats.cntDeltas++; typeStats.deltaBytes += out.length() - otp.getOffset(); return; } } TemporaryBuffer.Heap delta = delta(otp); out.writeHeader(otp, delta.length()); Deflater deflater = deflater(); deflater.reset(); DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater); delta.writeTo(dst, null); dst.finish(); typeStats.cntDeltas++; typeStats.deltaBytes += out.length() - otp.getOffset(); }
private void writeDeltaObjectDeflate(PackOutputStream out, final ObjectToPack otp) throws IOException { writeBase(out, otp.getDeltaBase()); crc32.reset(); otp.setOffset(out.length()); DeltaCache.Ref ref = otp.popCachedDelta(); if (ref != null) { byte[] zbuf = ref.get(); if (zbuf != null) { out.writeHeader(otp, otp.getCachedSize()); out.write(zbuf); typeStats.cntDeltas++; typeStats.deltaBytes += out.length() - otp.getOffset(); return; } } try (TemporaryBuffer.Heap delta = delta(otp)) { out.writeHeader(otp, delta.length()); Deflater deflater = deflater(); deflater.reset(); DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater); delta.writeTo(dst, null); dst.finish(); } typeStats.cntDeltas++; typeStats.deltaBytes += out.length() - otp.getOffset(); }
/** * Compute the ObjectId for this tree * * @param ins a {@link org.eclipse.jgit.lib.ObjectInserter} object. * @return ObjectId for this tree */ public ObjectId computeId(ObjectInserter ins) { if (buf != null) return ins.idFor(OBJ_TREE, buf, 0, ptr); final long len = overflowBuffer.length(); try { return ins.idFor(OBJ_TREE, len, overflowBuffer.openInputStream()); } catch (IOException e) { // this should never happen throw new RuntimeException(e); } }
/** * Insert this tree and obtain its ObjectId. * * @param ins * the inserter to store the tree. * @return computed ObjectId of the tree * @throws IOException * the tree could not be stored. */ public ObjectId insertTo(ObjectInserter ins) throws IOException { if (buf != null) return ins.insert(OBJ_TREE, buf, 0, ptr); final long len = overflowBuffer.length(); return ins.insert(OBJ_TREE, len, overflowBuffer.openInputStream()); }
/** * Insert this tree and obtain its ObjectId. * * @param ins * the inserter to store the tree. * @return computed ObjectId of the tree * @throws java.io.IOException * the tree could not be stored. */ public ObjectId insertTo(ObjectInserter ins) throws IOException { if (buf != null) return ins.insert(OBJ_TREE, buf, 0, ptr); final long len = overflowBuffer.length(); return ins.insert(OBJ_TREE, len, overflowBuffer.openInputStream()); }
private void selectDeltaBase(DeltaWindowEntry src, OutputStream delta) { bestBase = src; if (delta instanceof ArrayStream) { ArrayStream a = (ArrayStream) delta; deltaBuf = a.buf; deltaLen = a.cnt; } else { TemporaryBuffer.Heap b = (TemporaryBuffer.Heap) delta; deltaBuf = b; deltaLen = (int) b.length(); } }
private void selectDeltaBase(DeltaWindowEntry src, OutputStream delta) { bestBase = src; if (delta instanceof ArrayStream) { ArrayStream a = (ArrayStream) delta; deltaBuf = a.buf; deltaLen = a.cnt; } else { TemporaryBuffer.Heap b = (TemporaryBuffer.Heap) delta; deltaBuf = b; deltaLen = (int) b.length(); } }
/** * Insert this tree and obtain its ObjectId. * * @param ins * the inserter to store the tree. * @return computed ObjectId of the tree * @throws java.io.IOException * the tree could not be stored. */ public ObjectId insertTo(ObjectInserter ins) throws IOException { if (buf != null) return ins.insert(OBJ_TREE, buf, 0, ptr); final long len = overflowBuffer.length(); return ins.insert(OBJ_TREE, len, overflowBuffer.openInputStream()); }
private void selectDeltaBase(DeltaWindowEntry src, OutputStream delta) { bestBase = src; if (delta instanceof ArrayStream) { ArrayStream a = (ArrayStream) delta; deltaBuf = a.buf; deltaLen = a.cnt; } else { TemporaryBuffer.Heap b = (TemporaryBuffer.Heap) delta; deltaBuf = b; deltaLen = (int) b.length(); } }