void sendRequest() throws IOException { TemporaryBuffer buf = new TemporaryBuffer.Heap( http.getPostBuffer()); try (GZIPOutputStream gzip = new GZIPOutputStream(buf)) {
TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap(Integer.MAX_VALUE); tmp.write(out); tmp.write(last); tmp.copy(in); return ByteBuffer.wrap(tmp.toByteArray());
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(); }
void sendRequest() throws IOException { TemporaryBuffer buf = new TemporaryBuffer.Heap( http.getPostBuffer()); try (GZIPOutputStream gzip = new GZIPOutputStream(buf)) {
state = new TemporaryBuffer.Heap(Integer.MAX_VALUE); pckState = new PacketLineOut(state);
state = new TemporaryBuffer.Heap(Integer.MAX_VALUE); pckState = new PacketLineOut(state);
OutputStream delta = msz <= (8 << 10) ? new ArrayStream(msz) : new TemporaryBuffer.Heap(msz); if (srcIndex.encode(delta, resBuf, msz)) selectDeltaBase(src, delta);
TemporaryBuffer gzbuf = new TemporaryBuffer.Heap(LIMIT); try { GZIPOutputStream gzip = new GZIPOutputStream(gzbuf);
OutputStream delta = msz <= (8 << 10) ? new ArrayStream(msz) : new TemporaryBuffer.Heap(msz); if (srcIndex.encode(delta, resBuf, msz)) selectDeltaBase(src, delta);
TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap(Integer.MAX_VALUE); tmp.write(out); tmp.write(last); tmp.copy(in); return ByteBuffer.wrap(tmp.toByteArray());
TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap(Integer.MAX_VALUE); tmp.write(out); tmp.write(last); tmp.copy(in); return ByteBuffer.wrap(tmp.toByteArray());
TemporaryBuffer gzbuf = new TemporaryBuffer.Heap(LIMIT); try { GZIPOutputStream gzip = new GZIPOutputStream(gzbuf);
TemporaryBuffer.Heap raw = new TemporaryBuffer.Heap(bufArray.length); InflaterInputStream inf = new InflaterInputStream( new ByteArrayInputStream(bufArray, ptr, bufArray.length)); raw.copy(inf); inf.close(); return raw.toByteArray();
try { fmtOverflowBuffer(nameBuf, namePos, nameLen, mode); overflowBuffer.write(idBuf, idPos, OBJECT_ID_LENGTH); } catch (IOException badBuffer) {
try { fmtOverflowBuffer(nameBuf, namePos, nameLen, mode); overflowBuffer.write(idBuf, idPos, OBJECT_ID_LENGTH); } catch (IOException badBuffer) {
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(); }
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(); }
void sendRequest() throws IOException { // Try to compress the content, but only if that is smaller. TemporaryBuffer buf = new TemporaryBuffer.Heap(http.postBuffer); try { GZIPOutputStream gzip = new GZIPOutputStream(buf); out.writeTo(gzip, null); gzip.close(); if (out.length() < buf.length()) buf = out; } catch (IOException err) { // Most likely caused by overflowing the buffer, meaning // its larger if it were compressed. Don't compress. buf = out; } openStream(); if (buf != out) conn.setRequestProperty(HDR_CONTENT_ENCODING, ENCODING_GZIP); conn.setFixedLengthStreamingMode((int) buf.length()); final OutputStream httpOut = conn.getOutputStream(); try { buf.writeTo(httpOut, null); } finally { httpOut.close(); } }