Interface RepoCommand.RemoteReader

  • All Known Implementing Classes:
    RepoCommand.DefaultRemoteReader
    Enclosing class:
    RepoCommand

    public static interface RepoCommand.RemoteReader
    A callback to get ref sha1 of a repository from its uri. We provided a default implementation RepoCommand.DefaultRemoteReader to use ls-remote command to read the sha1 from the repository and clone the repository to read the file. Callers may have their own quicker implementation.
    Since:
    3.4
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      byte[] readFile​(java.lang.String uri, java.lang.String ref, java.lang.String path)
      Read a file from a remote repository.
      ObjectId sha1​(java.lang.String uri, java.lang.String ref)
      Read a remote ref sha1.
    • Method Detail

      • sha1

        ObjectId sha1​(java.lang.String uri,
                      java.lang.String ref)
               throws GitAPIException
        Read a remote ref sha1.
        Parameters:
        uri - The URI of the remote repository
        ref - The ref (branch/tag/etc.) to read
        Returns:
        the sha1 of the remote repository
        Throws:
        GitAPIException
      • readFile

        byte[] readFile​(java.lang.String uri,
                        java.lang.String ref,
                        java.lang.String path)
                 throws GitAPIException,
                        java.io.IOException
        Read a file from a remote repository.
        Parameters:
        uri - The URI of the remote repository
        ref - The ref (branch/tag/etc.) to read
        path - The relative path (inside the repo) to the file to read
        Returns:
        the file content.
        Throws:
        GitAPIException
        java.io.IOException
        Since:
        3.5