Codota Logo
PackOutputStream
Code IndexAdd Codota to your IDE (free)

How to use
PackOutputStream
in
org.eclipse.jgit.internal.storage.pack

Best Java code snippets using org.eclipse.jgit.internal.storage.pack.PackOutputStream (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: org.eclipse.jgit/org.eclipse.jgit

@Override
void write(PackOutputStream out, long pos, int cnt)
    throws IOException {
  final ByteBuffer s = buffer.slice();
  s.position((int) (pos - start));
  while (0 < cnt) {
    byte[] buf = out.getCopyBuffer();
    int n = Math.min(cnt, buf.length);
    s.get(buf, 0, n);
    out.write(buf, 0, n);
    cnt -= n;
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit

private void writeChecksum(PackOutputStream out) throws IOException {
  packcsum = out.getDigest();
  out.write(packcsum);
}
origin: org.eclipse.jgit/org.eclipse.jgit

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();
}
origin: org.eclipse.jgit/org.eclipse.jgit

private void writeObjects(PackOutputStream out, List<ObjectToPack> list)
    throws IOException {
  if (list.isEmpty())
    return;
  typeStats = stats.objectTypes[list.get(0).getType()];
  long beginOffset = out.length();
  if (reuseSupport != null) {
    reuseSupport.writeObjects(out, list);
  } else {
    for (ObjectToPack otp : list)
      out.writeObject(otp);
  }
  typeStats.bytes += out.length() - beginOffset;
  typeStats.cntObjects = list.size();
}
origin: org.eclipse.jgit/org.eclipse.jgit

final PackOutputStream out = new PackOutputStream(
  writeMonitor,
  isIndexDisabled()
long writeStart = System.currentTimeMillis();
try {
  out.writeFileHeader(PACK_VERSION_GENERATED, objCnt);
  out.flush();
  out.flush();
} finally {
  stats.timeWriting = System.currentTimeMillis() - writeStart;
stats.totalBytes = out.length();
reader.close();
endPhase(writeMonitor);
origin: org.eclipse.jgit/org.eclipse.jgit

final CRC32 crc1 = validate ? new CRC32() : null;
final CRC32 crc2 = validate ? new CRC32() : null;
final byte[] buf = out.getCopyBuffer();
  out.writeHeader(src, inflatedLength);
  quickCopy.write(out, dataOffset, (int) dataLength);
  out.writeHeader(src, inflatedLength);
  out.write(buf, 0, (int) dataLength);
} else {
  out.writeHeader(src, inflatedLength);
  long pos = dataOffset;
  long cnt = dataLength;
      crc2.update(buf, 0, n);
    out.write(buf, 0, n);
    pos += n;
    cnt -= n;
origin: org.eclipse.jgit/org.eclipse.jgit

ObjectToPack b = otp.getDeltaBase();
if (b != null && (b.isWritten() & ofsDelta)) { // Non-short-circuit logic is intentional
  int n = objectHeader(rawLength, OBJ_OFS_DELTA, headerBuffer);
  n = ofsDelta(count - b.getOffset(), headerBuffer, n);
  write(headerBuffer, 0, n);
} else if (otp.isDeltaRepresentation()) {
  int n = objectHeader(rawLength, OBJ_REF_DELTA, headerBuffer);
  otp.getDeltaBaseId().copyRawTo(headerBuffer, n);
  write(headerBuffer, 0, n + 20);
} else {
  int n = objectHeader(rawLength, otp.getType(), headerBuffer);
  write(headerBuffer, 0, n);
origin: org.eclipse.jgit/org.eclipse.jgit

void write(PackOutputStream out, long pos, int cnt)
    throws IOException {
  out.write(block, (int) (pos - start), cnt);
}
origin: org.eclipse.jgit/org.eclipse.jgit

private void writeWholeObjectDeflate(PackOutputStream out,
    final ObjectToPack otp) throws IOException {
  final Deflater deflater = deflater();
  final ObjectLoader ldr = reader.open(otp, otp.getType());
  crc32.reset();
  otp.setOffset(out.length());
  out.writeHeader(otp, ldr.getSize());
  deflater.reset();
  DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater);
  ldr.copyTo(dst);
  dst.finish();
}
origin: org.eclipse.jgit/org.eclipse.jgit

  otp.setOffset(out.length());
  try {
    reuseSupport.copyObjectAsIs(out, otp, reuseValidate);
    out.endObject();
    otp.setCRC((int) crc32.getValue());
    typeStats.reusedObjects++;
    if (otp.isDeltaRepresentation()) {
      typeStats.reusedDeltas++;
      typeStats.deltaBytes += out.length() - otp.getOffset();
    if (otp.getOffset() == out.length()) {
      otp.setOffset(0);
      otp.clearDeltaBase();
else
  writeWholeObjectDeflate(out, otp);
out.endObject();
otp.setCRC((int) crc32.getValue());
origin: com.madgag/org.eclipse.jgit.pgm

asis.selectObjectRepresentation(pw, NullProgressMonitor.INSTANCE,
    Collections.singleton(target));
asis.copyObjectAsIs(new PackOutputStream(NullProgressMonitor.INSTANCE,
    buf, pw), target, true);
origin: org.eclipse.jgit/org.eclipse.jgit

private ByteBuffer newCopyBuffer(PackOutputStream out, ReadableChannel rc) {
  int bs = blockSize(rc);
  byte[] copyBuf = out.getCopyBuffer();
  if (bs > copyBuf.length)
    copyBuf = new byte[bs];
  return ByteBuffer.wrap(copyBuf, 0, bs);
}
origin: org.eclipse.jgit/org.eclipse.jgit

private static final int ofsDelta(long diff, byte[] buf, int p) {
  p += ofsDeltaVarIntLength(diff);
  int n = p;
  buf[--n] = (byte) (diff & 0x7F);
  while ((diff >>>= 7) != 0)
    buf[--n] = (byte) (0x80 | (--diff & 0x7F));
  return p;
}
origin: sonia.jgit/org.eclipse.jgit

final PackOutputStream out = new PackOutputStream(
  writeMonitor,
  isIndexDisabled()
long writeStart = System.currentTimeMillis();
try {
  out.writeFileHeader(PACK_VERSION_GENERATED, objCnt);
  out.flush();
  out.flush();
} finally {
  stats.timeWriting = System.currentTimeMillis() - writeStart;
stats.totalBytes = out.length();
reader.close();
endPhase(writeMonitor);
origin: org.eclipse.jgit/org.eclipse.jgit

final CRC32 crc1 = validate ? new CRC32() : null;
final CRC32 crc2 = validate ? new CRC32() : null;
final byte[] buf = out.getCopyBuffer();
  out.writeHeader(src, inflatedLength);
  quickCopy.write(out, dataOffset, (int) dataLength);
  out.writeHeader(src, inflatedLength);
  out.write(buf, 0, (int) dataLength);
} else {
  out.writeHeader(src, inflatedLength);
  long pos = dataOffset;
  long cnt = dataLength;
      crc2.update(buf, 0, n);
    out.write(buf, 0, n);
    pos += n;
    cnt -= n;
origin: sonia.jgit/org.eclipse.jgit

ObjectToPack b = otp.getDeltaBase();
if (b != null && (b.isWritten() & ofsDelta)) {
  int n = objectHeader(rawLength, OBJ_OFS_DELTA, headerBuffer);
  n = ofsDelta(count - b.getOffset(), headerBuffer, n);
  write(headerBuffer, 0, n);
} else if (otp.isDeltaRepresentation()) {
  int n = objectHeader(rawLength, OBJ_REF_DELTA, headerBuffer);
  otp.getDeltaBaseId().copyRawTo(headerBuffer, n);
  write(headerBuffer, 0, n + 20);
} else {
  int n = objectHeader(rawLength, otp.getType(), headerBuffer);
  write(headerBuffer, 0, n);
origin: org.eclipse.jgit/org.eclipse.jgit

@Override
void write(PackOutputStream out, long pos, int cnt)
    throws IOException {
  int ptr = (int) (pos - start);
  out.write(array, ptr, cnt);
}
origin: sonia.jgit/org.eclipse.jgit

private void writeWholeObjectDeflate(PackOutputStream out,
    final ObjectToPack otp) throws IOException {
  final Deflater deflater = deflater();
  final ObjectLoader ldr = reader.open(otp, otp.getType());
  crc32.reset();
  otp.setOffset(out.length());
  out.writeHeader(otp, ldr.getSize());
  deflater.reset();
  DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater);
  ldr.copyTo(dst);
  dst.finish();
}
origin: sonia.jgit/org.eclipse.jgit

private void writeObjects(PackOutputStream out, List<ObjectToPack> list)
    throws IOException {
  if (list.isEmpty())
    return;
  typeStats = stats.objectTypes[list.get(0).getType()];
  long beginOffset = out.length();
  if (reuseSupport != null) {
    reuseSupport.writeObjects(out, list);
  } else {
    for (ObjectToPack otp : list)
      out.writeObject(otp);
  }
  typeStats.bytes += out.length() - beginOffset;
  typeStats.cntObjects = list.size();
}
origin: sonia.jgit/org.eclipse.jgit

  otp.setOffset(out.length());
  try {
    reuseSupport.copyObjectAsIs(out, otp, reuseValidate);
    out.endObject();
    otp.setCRC((int) crc32.getValue());
    typeStats.reusedObjects++;
    if (otp.isDeltaRepresentation()) {
      typeStats.reusedDeltas++;
      typeStats.deltaBytes += out.length() - otp.getOffset();
    if (otp.getOffset() == out.length()) {
      otp.setOffset(0);
      otp.clearDeltaBase();
else
  writeWholeObjectDeflate(out, otp);
out.endObject();
otp.setCRC((int) crc32.getValue());
org.eclipse.jgit.internal.storage.packPackOutputStream

Javadoc

Custom output stream to support org.eclipse.jgit.internal.storage.pack.PackWriter.

Most used methods

  • <init>
    Initialize a pack output stream. This constructor is exposed to support debugging the JGit library o
  • endObject
  • flush
  • getCopyBuffer
  • getDigest
  • length
  • objectHeader
  • ofsDelta
  • ofsDeltaVarIntLength
  • write
  • writeFileHeader
  • writeHeader
    Commits the object header onto the stream. Once the header has been written, the object representati
  • writeFileHeader,
  • writeHeader,
  • writeObject

Popular in Java

  • Start an intent from android
  • startActivity (Activity)
  • putExtra (Intent)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Path (java.nio.file)
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • TimerTask (java.util)
    A task that can be scheduled for one-time or repeated execution by a Timer.
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now