congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
RepoCommand$RemoteFile
Code IndexAdd Tabnine to your IDE (free)

How to use
RepoCommand$RemoteFile
in
org.eclipse.jgit.gitrepo

Best Java code snippets using org.eclipse.jgit.gitrepo.RepoCommand$RemoteFile (Showing top 6 results out of 315)

origin: org.eclipse.jgit/org.eclipse.jgit

  url, proj.getRevision(), copyfile.src);
objectId = inserter.insert(Constants.OBJ_BLOB,
    rf.getContents());
dcEntry = new DirCacheEntry(copyfile.dest);
dcEntry.setObjectId(objectId);
dcEntry.setFileMode(rf.getFileMode());
builder.add(dcEntry);
origin: berlam/github-bucket

  url, proj.getRevision(), copyfile.src);
objectId = inserter.insert(Constants.OBJ_BLOB,
    rf.getContents());
dcEntry = new DirCacheEntry(copyfile.dest);
dcEntry.setObjectId(objectId);
dcEntry.setFileMode(rf.getFileMode());
builder.add(dcEntry);
origin: berlam/github-bucket

  @Override
  public RemoteFile readFileWithMode(String uri, String ref, String path)
      throws GitAPIException, IOException {
    File dir = FileUtils.createTempDir("jgit_", ".git", null); //$NON-NLS-1$ //$NON-NLS-2$
    try (Git git = Git.cloneRepository().setBare(true).setDirectory(dir)
        .setURI(uri).call()) {
      Repository repo = git.getRepository();
      ObjectId refCommitId = sha1(uri, ref);
      if (refCommitId == null) {
        throw new InvalidRefNameException(MessageFormat
            .format(JGitText.get().refNotResolved, ref));
      }
      RevCommit commit = repo.parseCommit(refCommitId);
      TreeWalk tw = TreeWalk.forPath(repo, path, commit.getTree());
      // TODO(ifrade): Cope better with big files (e.g. using
      // InputStream instead of byte[])
      return new RemoteFile(
          tw.getObjectReader().open(tw.getObjectId(0))
              .getCachedBytes(Integer.MAX_VALUE),
          tw.getFileMode(0));
    } finally {
      FileUtils.delete(dir, FileUtils.RECURSIVE);
    }
  }
}
origin: berlam/github-bucket

/**
 * Read a file from a remote repository.
 *
 * @param uri
 *            The URI of the remote repository
 * @param ref
 *            The ref (branch/tag/etc.) to read
 * @param path
 *            The relative path (inside the repo) to the file to read
 * @return the file content.
 * @throws GitAPIException
 * @throws IOException
 * @since 3.5
 *
 * @deprecated Use {@link #readFileWithMode(String, String, String)}
 *             instead
 */
@Deprecated
public default byte[] readFile(String uri, String ref, String path)
    throws GitAPIException, IOException {
  return readFileWithMode(uri, ref, path).getContents();
}
origin: org.eclipse.jgit/org.eclipse.jgit

  @Override
  public RemoteFile readFileWithMode(String uri, String ref, String path)
      throws GitAPIException, IOException {
    File dir = FileUtils.createTempDir("jgit_", ".git", null); //$NON-NLS-1$ //$NON-NLS-2$
    try (Git git = Git.cloneRepository().setBare(true).setDirectory(dir)
        .setURI(uri).call()) {
      Repository repo = git.getRepository();
      ObjectId refCommitId = sha1(uri, ref);
      if (refCommitId == null) {
        throw new InvalidRefNameException(MessageFormat
            .format(JGitText.get().refNotResolved, ref));
      }
      RevCommit commit = repo.parseCommit(refCommitId);
      TreeWalk tw = TreeWalk.forPath(repo, path, commit.getTree());
      // TODO(ifrade): Cope better with big files (e.g. using
      // InputStream instead of byte[])
      return new RemoteFile(
          tw.getObjectReader().open(tw.getObjectId(0))
              .getCachedBytes(Integer.MAX_VALUE),
          tw.getFileMode(0));
    } finally {
      FileUtils.delete(dir, FileUtils.RECURSIVE);
    }
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * Read a file from a remote repository.
 *
 * @param uri
 *            The URI of the remote repository
 * @param ref
 *            The ref (branch/tag/etc.) to read
 * @param path
 *            The relative path (inside the repo) to the file to read
 * @return the file content.
 * @throws GitAPIException
 * @throws IOException
 * @since 3.5
 *
 * @deprecated Use {@link #readFileWithMode(String, String, String)}
 *             instead
 */
@Deprecated
public default byte[] readFile(String uri, String ref, String path)
    throws GitAPIException, IOException {
  return readFileWithMode(uri, ref, path).getContents();
}
org.eclipse.jgit.gitrepoRepoCommand$RemoteFile

Javadoc

Read-only view of contents and file mode (i.e. permissions) for a file in a remote repository.

Most used methods

  • <init>
  • getContents
    Contents of the file. Callers who receive this reference must not modify its contents (as it can poi
  • getFileMode

Popular in Java

  • Start an intent from android
  • onRequestPermissionsResult (Fragment)
  • getExternalFilesDir (Context)
  • startActivity (Activity)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now