Class Constants
- java.lang.Object
-
- org.eclipse.jgit.lib.Constants
-
public final class Constants extends java.lang.ObjectMisc. constants and helpers used throughout JGit.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringATTR_BUILTIN_BINARY_MERGERBinary value for custom merger.static java.lang.StringATTR_DIFFDiff attribute.static java.lang.StringATTR_FILTERKey for filters in .gitattributesstatic java.lang.StringATTR_FILTER_TYPE_CLEANclean command name, used to call filter driverstatic java.lang.StringATTR_FILTER_TYPE_SMUDGEsmudge command name, used to call filter driverstatic java.lang.StringATTR_MERGEMerge attribute.static java.lang.StringBUILTIN_FILTER_PREFIXBuiltin filter commands start with this prefixstatic java.lang.StringCHARACTER_ENCODINGDeprecated.UseStandardCharsets.UTF_8directly instead.static java.nio.charset.CharsetCHARSETDeprecated.UseStandardCharsets.UTF_8directly instead.static java.lang.StringCHERRY_PICK_HEADname of the file containing the ID of a cherry pick commit in case of conflictsstatic java.lang.StringCOMMIT_EDITMSGName of the file in which git commands and hooks store and read the message prepared for the upcoming commit.static java.lang.StringCONFIGDefault name for the Git repository configurationstatic java.lang.StringDEFAULT_REMOTE_NAMEDefault remote name used by clone, push and fetch operationsstatic java.lang.StringDOT_BUNDLE_EXTThe default extension for local bundle filesstatic java.lang.StringDOT_GITDefault name for the Git repository directorystatic java.lang.StringDOT_GIT_ATTRIBUTESName of the attributes filestatic java.lang.StringDOT_GIT_EXTA bare repository typically ends with this stringstatic java.lang.StringDOT_GIT_IGNOREName of the ignore filestatic java.lang.StringDOT_GIT_MODULESName of the submodules filestatic ObjectIdEMPTY_BLOB_IDWell-known object ID for the empty blob.static ObjectIdEMPTY_TREE_IDWell-known object ID for the empty tree.private static byte[]ENCODED_TYPE_BLOBprivate static byte[]ENCODED_TYPE_COMMITprivate static byte[]ENCODED_TYPE_TAGprivate static byte[]ENCODED_TYPE_TREEstatic java.lang.StringFETCH_HEADSpecial name for the "FETCH_HEAD" symbolic-ref.static java.lang.StringGIT_ALTERNATE_OBJECT_DIRECTORIES_KEYThe environment variable that tells us where to look for objects, besides the default objects directory.static java.lang.StringGIT_AUTHOR_EMAIL_KEYThe environment variable that contains the author's emailstatic java.lang.StringGIT_AUTHOR_NAME_KEYThe environment variable that contains the author's namestatic java.lang.StringGIT_CEILING_DIRECTORIES_KEYThe environment variable that limits how close to the root of the file systems JGit will traverse when looking for a repository root.static java.lang.StringGIT_COMMITTER_EMAIL_KEYThe environment variable that contains the commiter's emailstatic java.lang.StringGIT_COMMITTER_NAME_KEYThe environment variable that contains the commiter's namestatic java.lang.StringGIT_CONFIG_NOSYSTEM_KEYThe environment variable that blocks use of the system config filestatic java.lang.StringGIT_DIR_KEYThe environment variable that tells us which directory is the ".git" directorystatic java.lang.StringGIT_INDEX_FILE_KEYThe environment variable that tells us which file holds the Git index.static java.lang.StringGIT_OBJECT_DIRECTORY_KEYThe environment variable that tells us where objects are storedstatic java.lang.StringGIT_WORK_TREE_KEYThe environment variable that tells us which directory is the working directory.static java.lang.StringGITDIRPrefix of the first line in a ".git" filestatic java.lang.StringGITIGNORE_FILENAMEA gitignore file nameprivate static java.lang.StringHASH_FUNCTIONHash function used natively by Git for all objects.static java.lang.StringHEADSpecial name for the "HEAD" symbolic-ref.static java.lang.StringHOOKSName of the folder (inside gitDir) where the hooks are stored.static java.lang.StringINFO_ALTERNATESInfo alternates file (goes under OBJECTS)static java.lang.StringINFO_ATTRIBUTESAttributes-override-filestatic java.lang.StringINFO_EXCLUDEExcludes-filestatic java.lang.StringINFO_HTTP_ALTERNATESHTTP alternates file (goes under OBJECTS)static java.lang.StringINFO_REFSInfo refs folderstatic java.lang.StringLOCK_SUFFIXSuffix of lock file namestatic java.lang.StringLOGSLogs folder namestatic java.lang.StringMASTERDefault main branch namestatic java.lang.StringMERGE_HEADname of the file containing the IDs of the parents of a merge commitstatic java.lang.StringMERGE_MSGname of the file containing the commit msg for a merge commitstatic java.lang.StringMODULESName of the folder (inside gitDir) where submodules are storedstatic intOBJ_BADAn unknown or invalid object type code.static intOBJ_BLOBIn-pack object type: blob.static intOBJ_COMMITIn-pack object type: commit.static intOBJ_EXTIn-pack object type: extended types.static intOBJ_OFS_DELTAIn-pack object type: offset deltastatic intOBJ_REF_DELTAIn-pack object type: reference deltastatic intOBJ_TAGIn-pack object type: annotated tag.static intOBJ_TREEIn-pack object type: tree.static intOBJ_TYPE_5In-pack object type: reserved for future use.static intOBJECT_ID_LENGTHA Git object hash is 160 bits, i.e.static intOBJECT_ID_STRING_LENGTHA Git object can be expressed as a 40 character string of hexadecimal digits.static java.lang.StringOBJECTSObjects folder namestatic java.lang.StringORIG_HEADname of the ref ORIG_HEAD used by certain commands to store the original value of HEADstatic java.lang.StringOS_USER_DIRThe system property that contains the system user namestatic java.lang.StringOS_USER_NAME_KEYThe system property that contains the system user namestatic byte[]PACK_SIGNATUREPack file signature that occurs at file header - identifies file as Git packfile formatted.static java.lang.StringPACKED_REFSPacked refs filestatic java.lang.StringR_HEADSPrefix for branch refsstatic java.lang.StringR_NOTESPrefix for notes refsstatic java.lang.StringR_NOTES_COMMITSStandard notes refstatic java.lang.StringR_REFSPrefix for any refstatic java.lang.StringR_REMOTESPrefix for remotes refsstatic java.lang.StringR_STASHStandard stash refstatic java.lang.StringR_TAGSPrefix for tag refsstatic java.lang.StringREFTABLEReftable folder namestatic java.lang.StringREVERT_HEADname of the file containing the ID of a revert commit in case of conflictsstatic java.lang.StringSHALLOWName of the .git/shallow filestatic java.lang.StringSIGNED_OFF_BY_TAGBeginning of the common "Signed-off-by: " commit message linestatic java.lang.StringSQUASH_MSGname of the file containing the commit msg for a squash commitstatic java.lang.StringSTASHDefault stash branch namestatic java.lang.StringTABLES_LISTReftable table list name.static java.lang.StringTYPE_BLOBText string that identifies an object as a blob.static java.lang.StringTYPE_COMMITText string that identifies an object as a commit.static java.lang.StringTYPE_TAGText string that identifies an object as an annotated tag.static java.lang.StringTYPE_TREEText string that identifies an object as a tree.static java.lang.StringUNKNOWN_USER_DEFAULTDefault value for the user name if no other information is availablestatic java.lang.StringXDG_CONFIG_HOMEThe key of the XDG_CONFIG_HOME directory defined in the XDG base directory specification, see {@link "https://wiki.archlinux.org/index.php/XDG_Base_Directory"}
-
Constructor Summary
Constructors Modifier Constructor Description privateConstants()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intdecodeTypeString(AnyObjectId id, byte[] typeString, byte endMark, MutableInteger offset)Parse an encoded type string into a type constant.static byte[]encode(java.lang.String str)Convert a string to a byte array in the standard character encoding.static byte[]encodeASCII(long s)Convert an integer into its decimal representation.static byte[]encodeASCII(java.lang.String s)Convert a string to US-ASCII encoding.static byte[]encodedTypeString(int typeCode)Convert an OBJ_* type constant to an ASCII encoded string constant.static java.security.MessageDigestnewMessageDigest()Create a new digest function for objects.static java.lang.StringtypeString(int typeCode)Convert an OBJ_* type constant to a TYPE_* type constant.
-
-
-
Field Detail
-
HASH_FUNCTION
private static final java.lang.String HASH_FUNCTION
Hash function used natively by Git for all objects.- See Also:
- Constant Field Values
-
OBJECT_ID_LENGTH
public static final int OBJECT_ID_LENGTH
A Git object hash is 160 bits, i.e. 20 bytes.Changing this assumption is not going to be as easy as changing this declaration.
- See Also:
- Constant Field Values
-
OBJECT_ID_STRING_LENGTH
public static final int OBJECT_ID_STRING_LENGTH
A Git object can be expressed as a 40 character string of hexadecimal digits.- See Also:
OBJECT_ID_LENGTH, Constant Field Values
-
HEAD
public static final java.lang.String HEAD
Special name for the "HEAD" symbolic-ref.- See Also:
- Constant Field Values
-
FETCH_HEAD
public static final java.lang.String FETCH_HEAD
Special name for the "FETCH_HEAD" symbolic-ref.- See Also:
- Constant Field Values
-
TYPE_COMMIT
public static final java.lang.String TYPE_COMMIT
Text string that identifies an object as a commit.Commits connect trees into a string of project histories, where each commit is an assertion that the best way to continue is to use this other tree (set of files).
- See Also:
- Constant Field Values
-
TYPE_BLOB
public static final java.lang.String TYPE_BLOB
Text string that identifies an object as a blob.Blobs store whole file revisions. They are used for any user file, as well as for symlinks. Blobs form the bulk of any project's storage space.
- See Also:
- Constant Field Values
-
TYPE_TREE
public static final java.lang.String TYPE_TREE
Text string that identifies an object as a tree.Trees attach object ids (hashes) to names and file modes. The normal use for a tree is to store a version of a directory and its contents.
- See Also:
- Constant Field Values
-
TYPE_TAG
public static final java.lang.String TYPE_TAG
Text string that identifies an object as an annotated tag.Annotated tags store a pointer to any other object, and an additional message. It is most commonly used to record a stable release of the project.
- See Also:
- Constant Field Values
-
ENCODED_TYPE_COMMIT
private static final byte[] ENCODED_TYPE_COMMIT
-
ENCODED_TYPE_BLOB
private static final byte[] ENCODED_TYPE_BLOB
-
ENCODED_TYPE_TREE
private static final byte[] ENCODED_TYPE_TREE
-
ENCODED_TYPE_TAG
private static final byte[] ENCODED_TYPE_TAG
-
OBJ_BAD
public static final int OBJ_BAD
An unknown or invalid object type code.- See Also:
- Constant Field Values
-
OBJ_EXT
public static final int OBJ_EXT
In-pack object type: extended types.This header code is reserved for future expansion. It is currently undefined/unsupported.
- See Also:
- Constant Field Values
-
OBJ_COMMIT
public static final int OBJ_COMMIT
In-pack object type: commit.Indicates the associated object is a commit.
This constant is fixed and is defined by the Git packfile format.
- See Also:
TYPE_COMMIT, Constant Field Values
-
OBJ_TREE
public static final int OBJ_TREE
In-pack object type: tree.Indicates the associated object is a tree.
This constant is fixed and is defined by the Git packfile format.
- See Also:
TYPE_BLOB, Constant Field Values
-
OBJ_BLOB
public static final int OBJ_BLOB
In-pack object type: blob.Indicates the associated object is a blob.
This constant is fixed and is defined by the Git packfile format.
- See Also:
TYPE_BLOB, Constant Field Values
-
OBJ_TAG
public static final int OBJ_TAG
In-pack object type: annotated tag.Indicates the associated object is an annotated tag.
This constant is fixed and is defined by the Git packfile format.
- See Also:
TYPE_TAG, Constant Field Values
-
OBJ_TYPE_5
public static final int OBJ_TYPE_5
In-pack object type: reserved for future use.- See Also:
- Constant Field Values
-
OBJ_OFS_DELTA
public static final int OBJ_OFS_DELTA
In-pack object type: offset deltaObjects stored with this type actually have a different type which must be obtained from their delta base object. Delta objects store only the changes needed to apply to the base object in order to recover the original object.
An offset delta uses a negative offset from the start of this object to refer to its delta base. The base object must exist in this packfile (even in the case of a thin pack).
This constant is fixed and is defined by the Git packfile format.
- See Also:
- Constant Field Values
-
OBJ_REF_DELTA
public static final int OBJ_REF_DELTA
In-pack object type: reference deltaObjects stored with this type actually have a different type which must be obtained from their delta base object. Delta objects store only the changes needed to apply to the base object in order to recover the original object.
A reference delta uses a full object id (hash) to reference the delta base. The base object is allowed to be omitted from the packfile, but only in the case of a thin pack being transferred over the network.
This constant is fixed and is defined by the Git packfile format.
- See Also:
- Constant Field Values
-
PACK_SIGNATURE
public static final byte[] PACK_SIGNATURE
Pack file signature that occurs at file header - identifies file as Git packfile formatted.This constant is fixed and is defined by the Git packfile format.
-
CHARSET
@Deprecated public static final java.nio.charset.Charset CHARSET
Deprecated.UseStandardCharsets.UTF_8directly instead.Native character encoding for commit messages, file names...
-
CHARACTER_ENCODING
@Deprecated public static final java.lang.String CHARACTER_ENCODING
Deprecated.UseStandardCharsets.UTF_8directly instead.Native character encoding for commit messages, file names...
-
MASTER
public static final java.lang.String MASTER
Default main branch name- See Also:
- Constant Field Values
-
STASH
public static final java.lang.String STASH
Default stash branch name- See Also:
- Constant Field Values
-
R_HEADS
public static final java.lang.String R_HEADS
Prefix for branch refs- See Also:
- Constant Field Values
-
R_REMOTES
public static final java.lang.String R_REMOTES
Prefix for remotes refs- See Also:
- Constant Field Values
-
R_TAGS
public static final java.lang.String R_TAGS
Prefix for tag refs- See Also:
- Constant Field Values
-
R_NOTES
public static final java.lang.String R_NOTES
Prefix for notes refs- See Also:
- Constant Field Values
-
R_NOTES_COMMITS
public static final java.lang.String R_NOTES_COMMITS
Standard notes ref- See Also:
- Constant Field Values
-
R_REFS
public static final java.lang.String R_REFS
Prefix for any ref- See Also:
- Constant Field Values
-
R_STASH
public static final java.lang.String R_STASH
Standard stash ref- See Also:
- Constant Field Values
-
LOGS
public static final java.lang.String LOGS
Logs folder name- See Also:
- Constant Field Values
-
OBJECTS
public static final java.lang.String OBJECTS
Objects folder name- Since:
- 5.5
- See Also:
- Constant Field Values
-
REFTABLE
public static final java.lang.String REFTABLE
Reftable folder name- Since:
- 5.6
- See Also:
- Constant Field Values
-
TABLES_LIST
public static final java.lang.String TABLES_LIST
Reftable table list name.- Since:
- 5.6.2
- See Also:
- Constant Field Values
-
INFO_REFS
public static final java.lang.String INFO_REFS
Info refs folder- See Also:
- Constant Field Values
-
INFO_ALTERNATES
public static final java.lang.String INFO_ALTERNATES
Info alternates file (goes under OBJECTS)- Since:
- 5.5
- See Also:
- Constant Field Values
-
INFO_HTTP_ALTERNATES
public static final java.lang.String INFO_HTTP_ALTERNATES
HTTP alternates file (goes under OBJECTS)- Since:
- 5.5
- See Also:
- Constant Field Values
-
PACKED_REFS
public static final java.lang.String PACKED_REFS
Packed refs file- See Also:
- Constant Field Values
-
INFO_EXCLUDE
public static final java.lang.String INFO_EXCLUDE
Excludes-file- Since:
- 3.0
- See Also:
- Constant Field Values
-
INFO_ATTRIBUTES
public static final java.lang.String INFO_ATTRIBUTES
Attributes-override-file- Since:
- 4.2
- See Also:
- Constant Field Values
-
OS_USER_DIR
public static final java.lang.String OS_USER_DIR
The system property that contains the system user name- Since:
- 3.6
- See Also:
- Constant Field Values
-
OS_USER_NAME_KEY
public static final java.lang.String OS_USER_NAME_KEY
The system property that contains the system user name- See Also:
- Constant Field Values
-
GIT_AUTHOR_NAME_KEY
public static final java.lang.String GIT_AUTHOR_NAME_KEY
The environment variable that contains the author's name- See Also:
- Constant Field Values
-
GIT_AUTHOR_EMAIL_KEY
public static final java.lang.String GIT_AUTHOR_EMAIL_KEY
The environment variable that contains the author's email- See Also:
- Constant Field Values
-
GIT_COMMITTER_NAME_KEY
public static final java.lang.String GIT_COMMITTER_NAME_KEY
The environment variable that contains the commiter's name- See Also:
- Constant Field Values
-
GIT_COMMITTER_EMAIL_KEY
public static final java.lang.String GIT_COMMITTER_EMAIL_KEY
The environment variable that contains the commiter's email- See Also:
- Constant Field Values
-
GIT_CONFIG_NOSYSTEM_KEY
public static final java.lang.String GIT_CONFIG_NOSYSTEM_KEY
The environment variable that blocks use of the system config file- Since:
- 3.3
- See Also:
- Constant Field Values
-
XDG_CONFIG_HOME
public static final java.lang.String XDG_CONFIG_HOME
The key of the XDG_CONFIG_HOME directory defined in the XDG base directory specification, see {@link "https://wiki.archlinux.org/index.php/XDG_Base_Directory"}- Since:
- 5.5.2
- See Also:
- Constant Field Values
-
GIT_CEILING_DIRECTORIES_KEY
public static final java.lang.String GIT_CEILING_DIRECTORIES_KEY
The environment variable that limits how close to the root of the file systems JGit will traverse when looking for a repository root.- See Also:
- Constant Field Values
-
GIT_DIR_KEY
public static final java.lang.String GIT_DIR_KEY
The environment variable that tells us which directory is the ".git" directory- See Also:
- Constant Field Values
-
GIT_WORK_TREE_KEY
public static final java.lang.String GIT_WORK_TREE_KEY
The environment variable that tells us which directory is the working directory.- See Also:
- Constant Field Values
-
GIT_INDEX_FILE_KEY
public static final java.lang.String GIT_INDEX_FILE_KEY
The environment variable that tells us which file holds the Git index.- See Also:
- Constant Field Values
-
GIT_OBJECT_DIRECTORY_KEY
public static final java.lang.String GIT_OBJECT_DIRECTORY_KEY
The environment variable that tells us where objects are stored- See Also:
- Constant Field Values
-
GIT_ALTERNATE_OBJECT_DIRECTORIES_KEY
public static final java.lang.String GIT_ALTERNATE_OBJECT_DIRECTORIES_KEY
The environment variable that tells us where to look for objects, besides the default objects directory.- See Also:
- Constant Field Values
-
UNKNOWN_USER_DEFAULT
public static final java.lang.String UNKNOWN_USER_DEFAULT
Default value for the user name if no other information is available- See Also:
- Constant Field Values
-
SIGNED_OFF_BY_TAG
public static final java.lang.String SIGNED_OFF_BY_TAG
Beginning of the common "Signed-off-by: " commit message line- See Also:
- Constant Field Values
-
GITIGNORE_FILENAME
public static final java.lang.String GITIGNORE_FILENAME
A gitignore file name- See Also:
- Constant Field Values
-
DEFAULT_REMOTE_NAME
public static final java.lang.String DEFAULT_REMOTE_NAME
Default remote name used by clone, push and fetch operations- See Also:
- Constant Field Values
-
DOT_GIT
public static final java.lang.String DOT_GIT
Default name for the Git repository directory- See Also:
- Constant Field Values
-
CONFIG
public static final java.lang.String CONFIG
Default name for the Git repository configuration- See Also:
- Constant Field Values
-
DOT_GIT_EXT
public static final java.lang.String DOT_GIT_EXT
A bare repository typically ends with this string- See Also:
- Constant Field Values
-
DOT_BUNDLE_EXT
public static final java.lang.String DOT_BUNDLE_EXT
The default extension for local bundle files- Since:
- 5.8
- See Also:
- Constant Field Values
-
DOT_GIT_ATTRIBUTES
public static final java.lang.String DOT_GIT_ATTRIBUTES
Name of the attributes file- Since:
- 3.7
- See Also:
- Constant Field Values
-
ATTR_FILTER
public static final java.lang.String ATTR_FILTER
Key for filters in .gitattributes- Since:
- 4.2
- See Also:
- Constant Field Values
-
ATTR_FILTER_TYPE_CLEAN
public static final java.lang.String ATTR_FILTER_TYPE_CLEAN
clean command name, used to call filter driver- Since:
- 4.2
- See Also:
- Constant Field Values
-
ATTR_FILTER_TYPE_SMUDGE
public static final java.lang.String ATTR_FILTER_TYPE_SMUDGE
smudge command name, used to call filter driver- Since:
- 4.2
- See Also:
- Constant Field Values
-
BUILTIN_FILTER_PREFIX
public static final java.lang.String BUILTIN_FILTER_PREFIX
Builtin filter commands start with this prefix- Since:
- 4.6
- See Also:
- Constant Field Values
-
DOT_GIT_IGNORE
public static final java.lang.String DOT_GIT_IGNORE
Name of the ignore file- See Also:
- Constant Field Values
-
DOT_GIT_MODULES
public static final java.lang.String DOT_GIT_MODULES
Name of the submodules file- See Also:
- Constant Field Values
-
SHALLOW
public static final java.lang.String SHALLOW
Name of the .git/shallow file- See Also:
- Constant Field Values
-
GITDIR
public static final java.lang.String GITDIR
Prefix of the first line in a ".git" file- Since:
- 3.6
- See Also:
- Constant Field Values
-
MODULES
public static final java.lang.String MODULES
Name of the folder (inside gitDir) where submodules are stored- Since:
- 3.6
- See Also:
- Constant Field Values
-
HOOKS
public static final java.lang.String HOOKS
Name of the folder (inside gitDir) where the hooks are stored.- Since:
- 3.7
- See Also:
- Constant Field Values
-
ATTR_MERGE
public static final java.lang.String ATTR_MERGE
Merge attribute.- Since:
- 4.9
- See Also:
- Constant Field Values
-
ATTR_DIFF
public static final java.lang.String ATTR_DIFF
Diff attribute.- Since:
- 4.11
- See Also:
- Constant Field Values
-
ATTR_BUILTIN_BINARY_MERGER
public static final java.lang.String ATTR_BUILTIN_BINARY_MERGER
Binary value for custom merger.- Since:
- 4.9
- See Also:
- Constant Field Values
-
MERGE_MSG
public static final java.lang.String MERGE_MSG
name of the file containing the commit msg for a merge commit- See Also:
- Constant Field Values
-
MERGE_HEAD
public static final java.lang.String MERGE_HEAD
name of the file containing the IDs of the parents of a merge commit- See Also:
- Constant Field Values
-
CHERRY_PICK_HEAD
public static final java.lang.String CHERRY_PICK_HEAD
name of the file containing the ID of a cherry pick commit in case of conflicts- See Also:
- Constant Field Values
-
SQUASH_MSG
public static final java.lang.String SQUASH_MSG
name of the file containing the commit msg for a squash commit- See Also:
- Constant Field Values
-
REVERT_HEAD
public static final java.lang.String REVERT_HEAD
name of the file containing the ID of a revert commit in case of conflicts- See Also:
- Constant Field Values
-
ORIG_HEAD
public static final java.lang.String ORIG_HEAD
name of the ref ORIG_HEAD used by certain commands to store the original value of HEAD- See Also:
- Constant Field Values
-
COMMIT_EDITMSG
public static final java.lang.String COMMIT_EDITMSG
Name of the file in which git commands and hooks store and read the message prepared for the upcoming commit.- Since:
- 4.0
- See Also:
- Constant Field Values
-
EMPTY_BLOB_ID
public static final ObjectId EMPTY_BLOB_ID
Well-known object ID for the empty blob.- Since:
- 0.9.1
-
EMPTY_TREE_ID
public static final ObjectId EMPTY_TREE_ID
Well-known object ID for the empty tree.- Since:
- 5.1
-
LOCK_SUFFIX
public static final java.lang.String LOCK_SUFFIX
Suffix of lock file name- Since:
- 4.7
- See Also:
- Constant Field Values
-
-
Method Detail
-
newMessageDigest
public static java.security.MessageDigest newMessageDigest()
Create a new digest function for objects.- Returns:
- a new digest object.
- Throws:
java.lang.RuntimeException- this Java virtual machine does not support the required hash function. Very unlikely given that JGit uses a hash function that is in the Java reference specification.
-
typeString
public static java.lang.String typeString(int typeCode)
Convert an OBJ_* type constant to a TYPE_* type constant.- Parameters:
typeCode- the type code, from a pack representation.- Returns:
- the canonical string name of this type.
-
encodedTypeString
public static byte[] encodedTypeString(int typeCode)
Convert an OBJ_* type constant to an ASCII encoded string constant.The ASCII encoded string is often the canonical representation of the type within a loose object header, or within a tag header.
- Parameters:
typeCode- the type code, from a pack representation.- Returns:
- the canonical ASCII encoded name of this type.
-
decodeTypeString
public static int decodeTypeString(AnyObjectId id, byte[] typeString, byte endMark, MutableInteger offset) throws CorruptObjectException
Parse an encoded type string into a type constant.- Parameters:
id- object id this type string came from; may be null if that is not known at the time the parse is occurring.typeString- string version of the type code.endMark- character immediately following the type string. Usually ' ' (space) or '\n' (line feed).offset- position withintypeStringwhere the parse should start. Updated with the new position (just pastendMarkwhen the parse is successful.- Returns:
- a type code constant (one of
OBJ_BLOB,OBJ_COMMIT,OBJ_TAG,OBJ_TREE. - Throws:
CorruptObjectException- there is no valid type identified bytypeString.
-
encodeASCII
public static byte[] encodeASCII(long s)
Convert an integer into its decimal representation.- Parameters:
s- the integer to convert.- Returns:
- a decimal representation of the input integer. The returned array is the smallest array that will hold the value.
-
encodeASCII
public static byte[] encodeASCII(java.lang.String s)
Convert a string to US-ASCII encoding.- Parameters:
s- the string to convert. Must not contain any characters over 127 (outside of 7-bit ASCII).- Returns:
- a byte array of the same length as the input string, holding the same characters, in the same order.
- Throws:
java.lang.IllegalArgumentException- the input string contains one or more characters outside of the 7-bit ASCII character space.
-
encode
public static byte[] encode(java.lang.String str)
Convert a string to a byte array in the standard character encoding.- Parameters:
str- the string to convert. May contain any Unicode characters.- Returns:
- a byte array representing the requested string, encoded using the default character encoding (UTF-8).
- See Also:
CHARACTER_ENCODING
-
-