| Modifier and Type | Field and Description |
|---|---|
| private byte[] | |
| private TemporaryBuffer. | |
| private int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | TreeFormatter(int
estimated size of the tree, in bytes. Callers can use
size)entrySize(FileMode, int) to estimate the size of each
entry in advance of allocating the formatter.Create an empty formatter with the specified buffer size. |
| Modifier and Type | Method and Description |
|---|---|
| public void | append(String
name of the entry. name, RevCommit the ObjectId to store in this entry. commit)Add a link to a submodule commit, mode is |
| public void | append(String
name of the entry. name, RevTree the ObjectId to store in this entry. tree)Add a subtree, mode is |
| public void | append(String
name of the entry. name, RevBlob the ObjectId to store in this entry. blob)Add a regular file, mode is |
| public void | append(String
name of the entry. name, FileMode mode describing the treatment of mode, AnyObjectId id.the ObjectId to store in this entry. id)Append any entry to the tree. |
| public void | append(byte[]
name of the entry. The name should be UTF-8 encoded, but file
name encoding is not a well defined concept in Git. name, FileMode mode describing the treatment of mode, AnyObjectId id.the ObjectId to store in this entry. id)Append any entry to the tree. |
| public void | append(byte[]
buffer holding the name of the entry. The name should be UTF-8
encoded, but file name encoding is not a well defined concept
in Git. nameBuf, int first position within namePos, int nameBuf of the name data.number of bytes from nameLen, FileMode nameBuf to use as the name.mode describing the treatment of mode, AnyObjectId id.the ObjectId to store in this entry. id)Append any entry to the tree. |
| public void | append(byte[]
buffer holding the name of the entry. The name should be UTF-8
encoded, but file name encoding is not a well defined concept
in Git. nameBuf, int first position within namePos, int nameBuf of the name data.number of bytes from nameLen, FileMode nameBuf to use as the name.mode describing the treatment of mode, AnyObjectId id.the ObjectId to store in this entry. id, boolean allow an empty filename (creating a corrupt tree) allowEmptyName)Append any entry to the tree. |
| public void | append(byte[]
buffer holding the name of the entry. The name should be UTF-8
encoded, but file name encoding is not a well defined concept
in Git. nameBuf, int first position within namePos, int nameBuf of the name data.number of bytes from nameLen, FileMode nameBuf to use as the name.mode describing the treatment of mode, byte[] id.buffer holding the raw ObjectId of the entry. idBuf, int first position within idPos)idBuf to copy the id from.Append any entry to the tree. |
| public ObjectId | Returns: ObjectId for this treea ins)org. object.Compute the ObjectId for this tree |
| public static int | |
| private boolean | |
| private void | |
| public ObjectId | Returns: computed ObjectId of the treethe inserter to store the tree. ins)Insert this tree and obtain its ObjectId. |
| public byte[] | Returns: a copy of this formatter's buffer.Copy this formatter's buffer into a byte array. |
| public String |
| buf | back to summary |
|---|---|
| private byte[] buf | |
| overflowBuffer | back to summary |
|---|---|
| private TemporaryBuffer. | |
| ptr | back to summary |
|---|---|
| private int ptr | |
| TreeFormatter | back to summary |
|---|---|
| public TreeFormatter() Create an empty formatter with a default buffer size. | |
| TreeFormatter | back to summary |
|---|---|
| public TreeFormatter(int size) Create an empty formatter with the specified buffer size.
| |
| append | back to summary |
|---|---|
| public void append(String name, RevCommit commit) Add a link to a submodule commit, mode is | |
| append | back to summary |
|---|---|
| public void append(String name, RevTree tree) Add a subtree, mode is | |
| append | back to summary |
|---|---|
| public void append(String name, RevBlob blob) Add a regular file, mode is | |
| append | back to summary |
|---|---|
| public void append(String name, FileMode mode, AnyObjectId id) Append any entry to the tree.
| |
| append | back to summary |
|---|---|
| public void append(byte[] name, FileMode mode, AnyObjectId id) Append any entry to the tree.
| |
| append | back to summary |
|---|---|
| public void append(byte[] nameBuf, int namePos, int nameLen, FileMode mode, AnyObjectId id) Append any entry to the tree.
| |
| append | back to summary |
|---|---|
| public void append(byte[] nameBuf, int namePos, int nameLen, FileMode mode, AnyObjectId id, boolean allowEmptyName) Append any entry to the tree.
| |
| append | back to summary |
|---|---|
| public void append(byte[] nameBuf, int namePos, int nameLen, FileMode mode, byte[] idBuf, int idPos) Append any entry to the tree.
| |
| computeId | back to summary |
|---|---|
| public ObjectId computeId(ObjectInserter ins) Compute the ObjectId for this tree
| |
| entrySize | back to summary |
|---|---|
| public static int entrySize(FileMode mode, int nameLen) Compute the size of a tree entry record. This method can be used to estimate the correct size of a tree prior to allocating a formatter. Getting the size correct at allocation time ensures the internal buffer is sized correctly, reducing copying.
| |
| fmtBuf | back to summary |
|---|---|
| private boolean fmtBuf(byte[] nameBuf, int namePos, int nameLen, FileMode mode) | |
| fmtOverflowBuffer | back to summary |
|---|---|
| private void fmtOverflowBuffer(byte[] nameBuf, int namePos, int nameLen, FileMode mode) throws IOException | |
| insertTo | back to summary |
|---|---|
| public ObjectId insertTo(ObjectInserter ins) throws IOException Insert this tree and obtain its ObjectId.
| |
| toByteArray | back to summary |
|---|---|
| public byte[] toByteArray() Copy this formatter's buffer into a byte array.
This method is not efficient, as it needs to create a copy of the
internal buffer in order to supply an array of the correct size to the
caller. If the buffer is just to pass to an ObjectInserter, consider
using
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |