final class NoteParser extends CanonicalTreeParser
Modifier and Type | Field and Description |
---|---|
private NonNoteEntry |
firstNonNote |
private NonNoteEntry |
lastNonNote |
private int |
pathPadding |
private int |
prefixLen |
attributesNode, DEFAULT_PATH_SIZE, mode, parent, path, pathLen, pathOffset, zeroid
Modifier | Constructor and Description |
---|---|
private |
NoteParser(AbbreviatedObjectId prefix,
ObjectReader r,
ObjectId t) |
Modifier and Type | Method and 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 a
NoteBucket instance. |
private int |
parseFanoutCell() |
private FanoutBucket |
parseFanoutTree() |
private LeafBucket |
parseLeafTree() |
private boolean |
parseObjectId(MutableObjectId id) |
private InMemoryNoteBucket |
parseTree() |
private void |
storeNonNote() |
back, createSubtreeIterator, createSubtreeIterator, createSubtreeIterator0, eof, first, getEntryAttributesNode, getParent, hasId, idBuffer, idOffset, next, next, reset, reset, reset, resetRoot
createEmptyTreeIterator, ensurePathCapacity, findFile, findFile, getEntryFileMode, getEntryObjectId, getEntryObjectId, getEntryPathBuffer, getEntryPathHashCode, getEntryPathLength, getEntryPathString, getEntryRawMode, getName, getNameLength, getNameOffset, growPath, idEqual, isWorkTree, needsStopWalk, pathCompare, pathCompare, skip, stopWalk, toString
private final int prefixLen
private final int pathPadding
private NonNoteEntry firstNonNote
private NonNoteEntry lastNonNote
private NoteParser(AbbreviatedObjectId prefix, ObjectReader r, ObjectId t) throws IncorrectObjectTypeException, java.io.IOException
IncorrectObjectTypeException
java.io.IOException
static InMemoryNoteBucket parse(AbbreviatedObjectId prefix, ObjectId treeId, ObjectReader reader) throws java.io.IOException
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.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.java.io.IOException
- treeId
cannot be accessed.private InMemoryNoteBucket parse()
private InMemoryNoteBucket parseTree()
private LeafBucket parseLeafTree()
private boolean parseObjectId(MutableObjectId id)
private FanoutBucket parseFanoutTree()
private int parseFanoutCell()
private void storeNonNote()
private boolean isTree()
private boolean isHex()