Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.ObjectLoader.copyTo()


    ObjectLoader ol = repo.open(entry.getObjectId());
    File parentDir = f.getParentFile();
    File tmpFile = File.createTempFile("._" + f.getName(), null, parentDir);
    FileOutputStream channel = new FileOutputStream(tmpFile);
    try {
      ol.copyTo(channel);
    } finally {
      channel.close();
    }
    FS fs = repo.getFS();
    WorkingTreeOptions opt = repo.getConfig().get(WorkingTreeOptions.KEY);
View Full Code Here


        long len = reader.getObjectSize(id, org.eclipse.jgit.lib.Constants.OBJ_BLOB);
        setContentType(response, "application/octet-stream");
        response.setIntHeader("Content-Length", (int) len);
        ObjectLoader ldr = repository.open(id);
        ldr.copyTo(response.getOutputStream());
        served = true;
      }
    } finally {
      tw.release();
      rw.dispose();
View Full Code Here

        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

        ObjectLoader loader = repository.open(id);
        if (FileMode.SYMLINK == mode) {
          TarArchiveEntry entry = new TarArchiveEntry(tw.getPathString(),TarArchiveEntry.LF_SYMLINK);
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          loader.copyTo(bos);
          entry.setLinkName(bos.toString());
          entry.setModTime(modified);
          tos.putArchiveEntry(entry);
          tos.closeArchiveEntry();
        } else {
View Full Code Here

          TarArchiveEntry entry = new TarArchiveEntry(tw.getPathString());
          entry.setMode(mode.getBits());
          entry.setModTime(modified);
          entry.setSize(loader.getSize());
          tos.putArchiveEntry(entry);
          loader.copyTo(tos);
          tos.closeArchiveEntry();
        }
      }
      tos.finish();
      tos.close();
View Full Code Here

      if (opt.getAutoCRLF() == AutoCRLF.TRUE)
        channel = new AutoCRLFOutputStream(rawChannel);
      else
        channel = rawChannel;
      try {
        ol.copyTo(channel);
      } finally {
        channel.close();
      }
      if (opt.isFileMode() && fs.supportsExecute()) {
        if (FileMode.EXECUTABLE_FILE.equals(entry.getRawMode())) {
View Full Code Here

    otp.setOffset(out.length());
    out.writeHeader(otp, ldr.getSize());

    deflater.reset();
    DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater);
    ldr.copyTo(dst);
    dst.finish();
  }

  private void writeDeltaObjectDeflate(PackOutputStream out,
      final ObjectToPack otp) throws IOException {
View Full Code Here

        ObjectId objId = treeWalk.getObjectId(0);
        ObjectLoader loader = repo.open(objId);
        resp.setHeader("Cache-Control", "no-cache");
        resp.setHeader("ETag", "\"" + tree.getId().getName() + "\"");
        resp.setContentType("application/octet-stream");
        loader.copyTo(out);
        walk.release();
        treeWalk.release();
      }
    } finally {
      out.close();
View Full Code Here

    ObjectLoader ol = or.open(entry.getObjectId());
    File parentDir = f.getParentFile();
    File tmpFile = File.createTempFile("._" + f.getName(), null, parentDir);
    FileOutputStream channel = new FileOutputStream(tmpFile);
    try {
      ol.copyTo(channel);
    } finally {
      channel.close();
    }
    FS fs = repo.getFS();
    WorkingTreeOptions opt = repo.getConfig().get(WorkingTreeOptions.KEY);
View Full Code Here

    out.writeHeader(otp, ldr.getSize());

    deflater.reset();
    DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater);
    ldr.copyTo(dst);
    dst.finish();
  }

  private void writeDeltaObjectDeflate(PackOutputStream out,
      final ObjectToPack otp) throws IOException {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.