Package org.eclipse.jgit.notes
Class NoteParser
- java.lang.Object
-
- org.eclipse.jgit.treewalk.AbstractTreeIterator
-
- org.eclipse.jgit.treewalk.CanonicalTreeParser
-
- org.eclipse.jgit.notes.NoteParser
-
final class NoteParser extends CanonicalTreeParser
Custom tree parser to select note bucket type and load it.
-
-
Field Summary
Fields Modifier and Type Field Description private NonNoteEntry
firstNonNote
private NonNoteEntry
lastNonNote
private int
pathPadding
private int
prefixLen
-
Fields inherited from class org.eclipse.jgit.treewalk.AbstractTreeIterator
attributesNode, DEFAULT_PATH_SIZE, mode, parent, path, pathLen, pathOffset, zeroid
-
-
Constructor Summary
Constructors Modifier Constructor Description private
NoteParser(AbbreviatedObjectId prefix, ObjectReader r, ObjectId t)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
isHex()
private boolean
isTree()
private InMemoryNoteBucket
parse()
(package private) static InMemoryNoteBucket
parse(AbbreviatedObjectId prefix, ObjectId treeId, ObjectReader reader)
Parse a tree object into aNoteBucket
instance.private int
parseFanoutCell()
private FanoutBucket
parseFanoutTree()
private LeafBucket
parseLeafTree()
private boolean
parseObjectId(MutableObjectId id)
private InMemoryNoteBucket
parseTree()
private void
storeNonNote()
-
Methods inherited from class org.eclipse.jgit.treewalk.CanonicalTreeParser
back, createSubtreeIterator, createSubtreeIterator, createSubtreeIterator0, eof, first, getEntryAttributesNode, getParent, hasId, idBuffer, idOffset, next, next, reset, reset, reset, resetRoot
-
Methods inherited from class org.eclipse.jgit.treewalk.AbstractTreeIterator
createEmptyTreeIterator, ensurePathCapacity, findFile, findFile, getEntryFileMode, getEntryObjectId, getEntryObjectId, getEntryPathBuffer, getEntryPathHashCode, getEntryPathLength, getEntryPathString, getEntryRawMode, getName, getNameLength, getNameOffset, growPath, idEqual, isWorkTree, needsStopWalk, pathCompare, pathCompare, skip, stopWalk, toString
-
-
-
-
Field Detail
-
prefixLen
private final int prefixLen
-
pathPadding
private final int pathPadding
-
firstNonNote
private NonNoteEntry firstNonNote
-
lastNonNote
private NonNoteEntry lastNonNote
-
-
Constructor Detail
-
NoteParser
private NoteParser(AbbreviatedObjectId prefix, ObjectReader r, ObjectId t) throws IncorrectObjectTypeException, java.io.IOException
- Throws:
IncorrectObjectTypeException
java.io.IOException
-
-
Method Detail
-
parse
static InMemoryNoteBucket parse(AbbreviatedObjectId prefix, ObjectId treeId, ObjectReader reader) throws java.io.IOException
Parse a tree object into aNoteBucket
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 hasprefix.length() == 0
, the first-level subtrees should beprefix.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.
-
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()
-
-