Class GHTreeEntry


  • public class GHTreeEntry
    extends Object
    Provides information for Git Trees https://developer.github.com/v3/git/trees/
    Author:
    Daniel Teixeira - https://github.com/ddtxra
    See Also:
    GHTree
    • Constructor Detail

      • GHTreeEntry

        public GHTreeEntry()
    • Method Detail

      • getPath

        public String getPath()
        Get the path such as "subdir/file.txt"
        Returns:
        the path
      • getMode

        public String getMode()
        Get mode such as 100644.
        Returns:
        the mode
      • getSize

        public long getSize()
        Gets the size of the file, such as 132.
        Returns:
        The size of the path or 0 if it is a directory
      • getType

        public String getType()
        Gets the type such as: "blob", "tree", etc.
        Returns:
        The type
      • getSha

        public String getSha()
        SHA1 of this object.
        Returns:
        the sha
      • getUrl

        public URL getUrl()
        API URL to this Git data, such as https://api.github.com/repos/jenkinsci /jenkins/git/commits/b72322675eb0114363a9a86e9ad5a170d1d07ac0
        Returns:
        the url
      • asBlob

        public GHBlob asBlob()
                      throws IOException
        If this tree entry represents a file, then return its information. Otherwise null.
        Returns:
        the gh blob
        Throws:
        IOException - the io exception
      • readAsBlob

        public InputStream readAsBlob()
                               throws IOException
        If this tree entry represents a file, then return its content. Otherwise null.
        Returns:
        the input stream
        Throws:
        IOException - the io exception
      • asTree

        public GHTree asTree()
                      throws IOException
        If this tree entry represents a directory, then return it. Otherwise null.
        Returns:
        the gh tree
        Throws:
        IOException - the io exception