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

How to use
ChunkIndex
in
org.eclipse.jgit.storage.dht

Best Java code snippets using org.eclipse.jgit.storage.dht.ChunkIndex (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

void setChunkIndex(List<PackedObjectInfo> objs) {
  builder.setChunkIndex(ChunkIndex.create(objs));
}
origin: com.madgag/org.eclipse.jgit.storage.dht

  /**
   * @return the PackChunk instance.
   * @throws DhtException
   *             if early validation indicates the chunk data is corrupt
   *             or not recognized by this version of the library.
   */
  public PackChunk build() throws DhtException {
    ChunkIndex i;
    if (indexBuf != null)
      i = ChunkIndex.fromBytes(chunkKey, indexBuf, indexPtr, indexLen);
    else
      i = null;
    return new PackChunk(chunkKey, dataBuf, dataPtr, dataLen, i, meta);
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

/** @return the complete size of this chunk, in memory. */
int getTotalSize() {
  // Assume the index is part of the buffer, and report its total size..
  if (dataPtr != 0 || dataLen != dataBuf.length)
    return dataBuf.length;
  int sz = dataLen;
  if (index != null)
    sz += index.getIndexSize();
  return sz;
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

/**
 * Search for an object in the index.
 *
 * @param objId
 *            the object to locate.
 * @return offset of the object in the corresponding chunk; -1 if not found.
 */
final int findOffset(AnyObjectId objId) {
  int hi, lo;
  if (fanout != null) {
    int fb = objId.getFirstByte();
    lo = fb == 0 ? 0 : fanout[fb - 1];
    hi = fanout[fb];
  } else {
    lo = 0;
    hi = count;
  }
  while (lo < hi) {
    final int mid = (lo + hi) >>> 1;
    final int cmp = objId.compareTo(indexBuf, idPosition(mid));
    if (cmp < 0)
      hi = mid;
    else if (cmp == 0)
      return getOffset(mid);
    else
      lo = mid + 1;
  }
  return -1;
}
origin: com.madgag/org.eclipse.jgit.storage.dht

static byte[] create(List<? extends PackedObjectInfo> list) {
  int cnt = list.size();
  sortObjectList(list);
    for (PackedObjectInfo oe : list)
      buckets[oe.getFirstByte()]++;
    fanoutFormat = selectFanoutFormat(buckets);
  int offsetFormat = selectOffsetFormat(list);
  byte[] index = new byte[2 // header
      + 256 * fanoutFormat // (optional) fanout
  case 3:
    for (int i = 0; i < 256; i++, ptr += 3)
      encodeUInt24(index, ptr, buckets[i]);
    break;
  case 4:
      encodeUInt24(index, ptr, (int) oe.getOffset());
      ptr += 3;
origin: com.madgag/org.eclipse.jgit.storage.dht

int findOffset(RepositoryKey repo, AnyObjectId objId) {
  if (key.getRepositoryId() == repo.asInt() && index != null)
    return index.findOffset(objId);
  return -1;
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

/**
 * Get the offset of an object in the chunk.
 *
 * @param nth
 *            offset to return. Must be in range [0, getObjectCount).
 * @return the offset.
 */
public final int getOffset(int nth) {
  return getOffset(indexBuf, offsetTable, nth);
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

/**
 * Get an ObjectId from this index.
 *
 * @param nth
 *            the object to return. Must be in range [0, getObjectCount).
 * @return the object id.
 */
public final ObjectId getObjectId(int nth) {
  return ObjectId.fromRaw(indexBuf, idPosition(nth));
}
origin: com.madgag/org.eclipse.jgit.storage.dht

fanout = new int[256];
for (int i = 0; i < 256; i++) {
  last += decodeUInt24(indexBuf, ptr + 2 + i * 3);
  fanout[i] = last;
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

static byte[] create(List<? extends PackedObjectInfo> list) {
  int cnt = list.size();
  sortObjectList(list);
    for (PackedObjectInfo oe : list)
      buckets[oe.getFirstByte()]++;
    fanoutFormat = selectFanoutFormat(buckets);
  int offsetFormat = selectOffsetFormat(list);
  byte[] index = new byte[2 // header
      + 256 * fanoutFormat // (optional) fanout
  case 3:
    for (int i = 0; i < 256; i++, ptr += 3)
      encodeUInt24(index, ptr, buckets[i]);
    break;
  case 4:
      encodeUInt24(index, ptr, (int) oe.getOffset());
      ptr += 3;
origin: com.madgag/org.eclipse.jgit.storage.dht

/**
 * Search for an object in the index.
 *
 * @param objId
 *            the object to locate.
 * @return offset of the object in the corresponding chunk; -1 if not found.
 */
final int findOffset(AnyObjectId objId) {
  int hi, lo;
  if (fanout != null) {
    int fb = objId.getFirstByte();
    lo = fb == 0 ? 0 : fanout[fb - 1];
    hi = fanout[fb];
  } else {
    lo = 0;
    hi = count;
  }
  while (lo < hi) {
    final int mid = (lo + hi) >>> 1;
    final int cmp = objId.compareTo(indexBuf, idPosition(mid));
    if (cmp < 0)
      hi = mid;
    else if (cmp == 0)
      return getOffset(mid);
    else
      lo = mid + 1;
  }
  return -1;
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

int findOffset(RepositoryKey repo, AnyObjectId objId) {
  if (key.getRepositoryId() == repo.asInt() && index != null)
    return index.findOffset(objId);
  return -1;
}
origin: com.madgag/org.eclipse.jgit.storage.dht

/**
 * Get the offset of an object in the chunk.
 *
 * @param nth
 *            offset to return. Must be in range [0, getObjectCount).
 * @return the offset.
 */
public final int getOffset(int nth) {
  return getOffset(indexBuf, offsetTable, nth);
}
origin: com.madgag/org.eclipse.jgit.storage.dht

/**
 * Get an ObjectId from this index.
 *
 * @param nth
 *            the object to return. Must be in range [0, getObjectCount).
 * @return the object id.
 */
public final ObjectId getObjectId(int nth) {
  return ObjectId.fromRaw(indexBuf, idPosition(nth));
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

fanout = new int[256];
for (int i = 0; i < 256; i++) {
  last += decodeUInt24(indexBuf, ptr + 2 + i * 3);
  fanout[i] = last;
origin: com.madgag/org.eclipse.jgit.storage.dht

void setChunkIndex(List<PackedObjectInfo> objs) {
  builder.setChunkIndex(ChunkIndex.create(objs));
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

ObjectId id = ObjectId.fromRaw(dataBuf, posPtr + p);
PackChunk nc = pc;
int base = pc.index.findOffset(id);
if (base < 0) {
  DhtReader.ChunkAndOffset n;
origin: com.madgag/org.eclipse.jgit.storage.dht

/** @return the complete size of this chunk, in memory. */
int getTotalSize() {
  // Assume the index is part of the buffer, and report its total size..
  if (dataPtr != 0 || dataLen != dataBuf.length)
    return dataBuf.length;
  int sz = dataLen;
  if (index != null)
    sz += index.getIndexSize();
  return sz;
}
origin: org.eclipse.jgit/org.eclipse.jgit.storage.dht

  /**
   * @return the PackChunk instance.
   * @throws DhtException
   *             if early validation indicates the chunk data is corrupt
   *             or not recognized by this version of the library.
   */
  public PackChunk build() throws DhtException {
    ChunkIndex i;
    if (indexBuf != null)
      i = ChunkIndex.fromBytes(chunkKey, indexBuf, indexPtr, indexLen);
    else
      i = null;
    return new PackChunk(chunkKey, dataBuf, dataPtr, dataLen, i, meta);
  }
}
origin: com.madgag/org.eclipse.jgit.storage.dht

builder.setChunkKey(key);
byte[] index = ChunkIndex.create(objectList);
info.setIndexSize(index.length);
builder.setChunkIndex(index);
org.eclipse.jgit.storage.dhtChunkIndex

Javadoc

Index into a PackChunk.

Most used methods

  • create
    Format the chunk index and return its binary representation.
  • decodeUInt24
  • encodeUInt24
  • findOffset
    Search for an object in the index.
  • fromBytes
  • getIndexSize
  • getOffset
  • idPosition
  • selectFanoutFormat
  • selectOffsetFormat
  • sortObjectList
  • sortObjectList

Popular in Java

  • Start an intent from android
  • getContentResolver (Context)
  • requestLocationUpdates (LocationManager)
  • addToBackStack (FragmentTransaction)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
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