Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.ObjectLoader$SmallObject


        continue;

      if (needBaseObjectIds)
        baseObjectIds.add(baseId);

      final ObjectLoader ldr;
      try {
        ldr = readCurs.open(baseId);
      } catch (MissingObjectException notFound) {
        missing.add(baseId);
        continue;
      }

      final DeltaVisit visit = new DeltaVisit();
      visit.data = ldr.getCachedBytes(Integer.MAX_VALUE);
      visit.id = baseId;
      final int typeCode = ldr.getType();
      final PackedObjectInfo oe = newInfo(baseId, null, null);

      if (onAppendBase(typeCode, visit.data, oe))
        entries[entryCount++] = oe;
View Full Code Here


      }
    }

    if (isCheckObjectCollisions()) {
      try {
        final ObjectLoader ldr = readCurs.open(id, type);
        final byte[] existingData = ldr.getCachedBytes(data.length);
        if (!Arrays.equals(data, existingData)) {
          throw new IOException(MessageFormat.format(
              JGitText.get().collisionOn, id.name()));
        }
      } catch (MissingObjectException notLocal) {
View Full Code Here

  }

  public ObjectLoader open(AnyObjectId objectId, int typeHint)
      throws MissingObjectException, IncorrectObjectTypeException,
      IOException {
    final ObjectLoader ldr = db.openObject(this, objectId);
    if (ldr == null) {
      if (typeHint == OBJ_ANY)
        throw new MissingObjectException(objectId.copy(), "unknown");
      throw new MissingObjectException(objectId.copy(), typeHint);
    }
    if (typeHint != OBJ_ANY && ldr.getType() != typeHint)
      throw new IncorrectObjectTypeException(objectId.copy(), typeHint);
    return ldr;
  }
View Full Code Here

      else
        throw new AmbiguousObjectException(id, ids);
    }

    try {
      ObjectLoader ldr = source.open(side, entry);
      return ldr.getBytes(binaryFileThreshold);

    } catch (LargeObjectException.ExceedsLimit overLimit) {
      return BINARY;

    } catch (LargeObjectException.ExceedsByteArrayLimit overLimit) {
View Full Code Here

      return ours;

    if (ours.getData().equals(theirs.getData()))
      return ours;

    ObjectLoader lo = reader.open(ours.getData());
    ObjectLoader lt = reader.open(theirs.getData());
    UnionInputStream union = new UnionInputStream(lo.openStream(),
        lt.openStream());
    ObjectId noteData = inserter.insert(Constants.OBJ_BLOB,
        lo.getSize() + lt.getSize(), union);
    return new Note(ours, noteData);
  }
View Full Code Here

    }

    @Override
    public ObjectLoader open(String path, ObjectId id) throws IOException {
      seek(path);
      return new ObjectLoader() {
        @Override
        public long getSize() {
          return ptr.getEntryLength();
        }
View Full Code Here

    @Override
    public ObjectLoader open(String path, ObjectId id) throws IOException {
      final File p = new File(root, path);
      if (!p.isFile())
        throw new FileNotFoundException(path);
      return new ObjectLoader() {
        @Override
        public long getSize() {
          return p.length();
        }
View Full Code Here

          continue;
        }
        ObjectId entid = tw.getObjectId(0);
        FileMode entmode = tw.getFileMode(0);
        if (entmode != FileMode.GITLINK) {
          ObjectLoader ldr = repository.open(entid, Constants.OBJ_BLOB);
          content = ldr.getCachedBytes();
        }
      }
    } catch (Throwable t) {
      if (throwError) {
        error(t, repository, "{0} can't find {1} in tree {2}", path, tree.name());
View Full Code Here

  public static byte[] getByteContent(Repository repository, String objectId) {
    RevWalk rw = new RevWalk(repository);
    byte[] content = null;
    try {
      RevBlob blob = rw.lookupBlob(ObjectId.fromString(objectId));
      ObjectLoader ldr = repository.open(blob.getId(), Constants.OBJ_BLOB);
      content = ldr.getCachedBytes();
    } catch (Throwable t) {
      error(t, repository, "{0} can't find blob {1}", objectId);
    } finally {
      rw.dispose();
    }
View Full Code Here

        entry.setComment(commit.getName());
        entry.setUnixMode(mode.getBits());
        entry.setTime(modified);
        zos.putArchiveEntry(entry);

        ObjectLoader ldr = repository.open(id);
        ldr.copyTo(zos);
        zos.closeArchiveEntry();
      }
      zos.finish();
      success = true;
    } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.lib.ObjectLoader$SmallObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.