java.lang.Object
org.eclipse.jgit.lib.AnyObjectId
org.eclipse.jgit.lib.MutableObjectId
- All Implemented Interfaces:
Comparable<AnyObjectId>
A mutable SHA-1 abstraction.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Make this id matchObjectId.zeroId().voidfromObjectId(AnyObjectId src) Copy an ObjectId into this mutable buffer.voidfromRaw(byte[] bs) Convert an ObjectId from raw binary representation.voidfromRaw(byte[] bs, int p) Convert an ObjectId from raw binary representation.voidfromRaw(int[] ints) Convert an ObjectId from binary representation expressed in integers.voidfromRaw(int[] ints, int p) Convert an ObjectId from binary representation expressed in integers.voidfromString(byte[] buf, int offset) Convert an ObjectId from hex characters (US-ASCII).voidfromString(String str) Convert an ObjectId from hex characters.voidset(int a, int b, int c, int d, int e) Convert an ObjectId from binary representation expressed in integers.voidsetByte(int index, int value) Set any byte in the id.Obtain an immutable copy of this current object name value.Methods inherited from class org.eclipse.jgit.lib.AnyObjectId
abbreviate, compareTo, compareTo, compareTo, copy, copyRawTo, copyRawTo, copyRawTo, copyRawTo, copyTo, copyTo, copyTo, copyTo, copyTo, copyTo, equals, equals, equals, getByte, getFirstByte, getName, hashCode, isEqual, name, startsWith, toString
-
Constructor Details
-
MutableObjectId
public MutableObjectId()Empty constructor. Initialize object with default (zeros) value.
-
-
Method Details
-
setByte
public void setByte(int index, int value) Set any byte in the id.- Parameters:
index- index of the byte to set in the raw form of the ObjectId. Must be in range [0,Constants.OBJECT_ID_LENGTH).value- the value of the specified byte atindex. Values are unsigned and thus are in the range [0,255] rather than the signed byte range of [-128, 127].- Throws:
ArrayIndexOutOfBoundsException-indexis less than 0, equal toConstants.OBJECT_ID_LENGTH, or greater thanConstants.OBJECT_ID_LENGTH.
-
clear
public void clear()Make this id matchObjectId.zeroId(). -
fromObjectId
Copy an ObjectId into this mutable buffer.- Parameters:
src- the source id to copy from.
-
fromRaw
public void fromRaw(byte[] bs) Convert an ObjectId from raw binary representation.- Parameters:
bs- the raw byte buffer to read from. At least 20 bytes must be available within this byte array.
-
fromRaw
public void fromRaw(byte[] bs, int p) Convert an ObjectId from raw binary representation.- Parameters:
bs- the raw byte buffer to read from. At least 20 bytes after p must be available within this byte array.p- position to read the first byte of data from.
-
fromRaw
public void fromRaw(int[] ints) Convert an ObjectId from binary representation expressed in integers.- Parameters:
ints- the raw int buffer to read from. At least 5 integers must be available within this integers array.
-
fromRaw
public void fromRaw(int[] ints, int p) Convert an ObjectId from binary representation expressed in integers.- Parameters:
ints- the raw int buffer to read from. At least 5 integers after p must be available within this integers array.p- position to read the first integer of data from.
-
set
public void set(int a, int b, int c, int d, int e) Convert an ObjectId from binary representation expressed in integers.- Parameters:
a- an int.b- an int.c- an int.d- an int.e- an int.- Since:
- 4.7
-
fromString
public void fromString(byte[] buf, int offset) Convert an ObjectId from hex characters (US-ASCII).- Parameters:
buf- the US-ASCII buffer to read from. At least 40 bytes after offset must be available within this byte array.offset- position to read the first character from.
-
fromString
Convert an ObjectId from hex characters.- Parameters:
str- the string to read from. Must be 40 characters long.
-
toObjectId
Description copied from class:AnyObjectIdObtain an immutable copy of this current object name value.See
AnyObjectId.copy()ifthisis a possibly subclassed (but immutable) identity and the application needs a lightweight identity only reference.- Specified by:
toObjectIdin classAnyObjectId- Returns:
- an immutable copy. May be
thisif this is already an immutable instance.
-