Class NoteParser


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

    • prefixLen

      private final int prefixLen
    • pathPadding

      private final int pathPadding
    • firstNonNote

      private NonNoteEntry firstNonNote
    • lastNonNote

      private NonNoteEntry lastNonNote
  • Constructor Details

  • Method Details

    • parse

      static InMemoryNoteBucket parse(AbbreviatedObjectId prefix, ObjectId treeId, ObjectReader reader) throws 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:
      IOException - treeId cannot be accessed.
    • parse

      private InMemoryNoteBucket parse()
    • parseTree

      private InMemoryNoteBucket parseTree()
    • parseLeafTree

      private LeafBucket parseLeafTree()
    • parseObjectId

      private boolean parseObjectId(MutableObjectId id)
    • parseFanoutTree

      private FanoutBucket parseFanoutTree()
    • parseFanoutCell

      private int parseFanoutCell()
    • storeNonNote

      private void storeNonNote()
    • isTree

      private boolean isTree()
    • isHex

      private boolean isHex()