Class Tree

    • Constructor Detail

      • Tree

        public Tree​(Repository repo)
        Deprecated.
        Constructor for a new Tree
        Parameters:
        repo - The repository that owns the Tree.
      • Tree

        public Tree​(Repository repo,
                    ObjectId myId,
                    byte[] raw)
             throws java.io.IOException
        Deprecated.
        Construct a Tree object with known content and hash value
        Parameters:
        repo -
        myId -
        raw -
        Throws:
        java.io.IOException
      • Tree

        public Tree​(Tree parent,
                    byte[] nameUTF8)
        Deprecated.
        Construct a new Tree under another Tree
        Parameters:
        parent -
        nameUTF8 -
      • Tree

        public Tree​(Tree parent,
                    ObjectId id,
                    byte[] nameUTF8)
        Deprecated.
        Construct a Tree with a known SHA-1 under another tree. Data is not yet specified and will have to be loaded on demand.
        Parameters:
        parent -
        id -
        nameUTF8 -
    • Method Detail

      • compareNames

        public static final int compareNames​(byte[] a,
                                             byte[] b,
                                             int lasta,
                                             int lastb)
        Deprecated.
        Compare two names represented as bytes. Since git treats names of trees and blobs differently we have one parameter that represents a '/' for trees. For other objects the value should be NUL. The names are compare by their positive byte value (0..255). A blob and a tree with the same name will not compare equal.
        Parameters:
        a - name
        b - name
        lasta - '/' if a is a tree, else NUL
        lastb - '/' if b is a tree, else NUL
        Returns:
        < 0 if a is sorted before b, 0 if they are the same, else b
      • getMode

        public FileMode getMode()
        Deprecated.
        Specified by:
        getMode in class TreeEntry
        Returns:
        mode (type of object)
      • isRoot

        public boolean isRoot()
        Deprecated.
        Returns:
        true if this Tree is the top level Tree.
      • isLoaded

        public boolean isLoaded()
        Deprecated.
        Returns:
        true of the data of this Tree is loaded
      • unload

        public void unload()
        Deprecated.
        Forget the in-memory data for this tree.
      • addFile

        public FileTreeEntry addFile​(java.lang.String name)
                              throws java.io.IOException
        Deprecated.
        Adds a new or existing file with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.
        Parameters:
        name - Name
        Returns:
        a FileTreeEntry for the added file.
        Throws:
        java.io.IOException
      • addFile

        public FileTreeEntry addFile​(byte[] s,
                                     int offset)
                              throws java.io.IOException
        Deprecated.
        Adds a new or existing file with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.
        Parameters:
        s - an array containing the name
        offset - when the name starts in the tree.
        Returns:
        a FileTreeEntry for the added file.
        Throws:
        java.io.IOException
      • addTree

        public Tree addTree​(java.lang.String name)
                     throws java.io.IOException
        Deprecated.
        Adds a new or existing Tree with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.
        Parameters:
        name - Name
        Returns:
        a FileTreeEntry for the added tree.
        Throws:
        java.io.IOException
      • addTree

        public Tree addTree​(byte[] s,
                            int offset)
                     throws java.io.IOException
        Deprecated.
        Adds a new or existing Tree with the specified name to this tree. Trees are added if necessary as the name may contain '/':s.
        Parameters:
        s - an array containing the name
        offset - when the name starts in the tree.
        Returns:
        a FileTreeEntry for the added tree.
        Throws:
        java.io.IOException
      • addEntry

        public void addEntry​(TreeEntry e)
                      throws java.io.IOException
        Deprecated.
        Add the specified tree entry to this tree.
        Parameters:
        e -
        Throws:
        java.io.IOException
      • memberCount

        public int memberCount()
                        throws java.io.IOException
        Deprecated.
        Returns:
        number of members in this tree
        Throws:
        java.io.IOException
      • members

        public TreeEntry[] members()
                            throws java.io.IOException
        Deprecated.
        Return all members of the tree sorted in Git order. Entries are sorted by the numerical unsigned byte values with (sub)trees having an implicit '/'. An example of a tree with three entries. a:b is an actual file name here.

        100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 a.b 040000 tree 4277b6e69d25e5efa77c455340557b384a4c018a a 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 a:b

        Returns:
        all entries in this Tree, sorted.
        Throws:
        java.io.IOException
      • existsTree

        public boolean existsTree​(java.lang.String path)
                           throws java.io.IOException
        Deprecated.
        Parameters:
        path - to the tree.
        Returns:
        true if a tree with the specified path can be found under this tree.
        Throws:
        java.io.IOException
      • existsBlob

        public boolean existsBlob​(java.lang.String path)
                           throws java.io.IOException
        Deprecated.
        Parameters:
        path - of the non-tree entry.
        Returns:
        true if a blob, symlink, or gitlink with the specified name can be found under this tree.
        Throws:
        java.io.IOException
      • findBlobMember

        public TreeEntry findBlobMember​(java.lang.String s)
                                 throws java.io.IOException
        Deprecated.
        Parameters:
        s - blob name
        Returns:
        a TreeEntry representing an object with the specified relative path.
        Throws:
        java.io.IOException
      • findTreeMember

        public TreeEntry findTreeMember​(java.lang.String s)
                                 throws java.io.IOException
        Deprecated.
        Parameters:
        s - Tree Name
        Returns:
        a Tree with the name s or null
        Throws:
        java.io.IOException
      • format

        public byte[] format()
                      throws java.io.IOException
        Deprecated.
        Format this Tree in canonical format.
        Returns:
        canonical encoding of the tree object.
        Throws:
        java.io.IOException - the tree cannot be loaded, or its not in a writable state.
      • toString

        public java.lang.String toString()
        Deprecated.
        Overrides:
        toString in class java.lang.Object