Class NoteParser


  • final class NoteParser
    extends CanonicalTreeParser
    Custom tree parser to select note bucket type and load it.
    • Field Detail

      • prefixLen

        private final int prefixLen
      • pathPadding

        private final int pathPadding
    • Method Detail

      • parse

        static InMemoryNoteBucket parse​(AbbreviatedObjectId prefix,
                                        ObjectId treeId,
                                        ObjectReader reader)
                                 throws java.io.IOException
        Parse a tree object into a NoteBucket instance. The type of note tree is automatically detected by examining the items within the tree, and allocating the proper storage type based on the first note-like entry encountered. Since the method parses by guessing the type on the first element, malformed note trees can be read as the wrong type of tree. This method is not recursive, it parses the one tree given to it and returns the bucket. If there are subtrees for note storage, they are setup as lazy pointers that will be resolved at a later time.
        Parameters:
        prefix - common hex digits that all notes within this tree share. The root tree has prefix.length() == 0, the first-level subtrees should be prefix.length()==2, etc.
        treeId - the tree to read from the repository.
        reader - reader to access the tree object.
        Returns:
        bucket to holding the notes of the specified tree.
        Throws:
        java.io.IOException - treeId cannot be accessed.
      • parseLeafTree

        private LeafBucket parseLeafTree()
      • parseFanoutCell

        private int parseFanoutCell()
      • storeNonNote

        private void storeNonNote()
      • isTree

        private boolean isTree()
      • isHex

        private boolean isHex()