Package org.eclipse.jgit.lfs.lib
Class MutableLongObjectId
java.lang.Object
org.eclipse.jgit.lfs.lib.AnyLongObjectId
org.eclipse.jgit.lfs.lib.MutableLongObjectId
- All Implemented Interfaces:
Comparable<AnyLongObjectId>
A mutable SHA-256 abstraction.
Ported to SHA-256 from
MutableObjectId- Since:
- 4.3
-
Field Summary
Fields inherited from class org.eclipse.jgit.lfs.lib.AnyLongObjectId
w1, w2, w3, w4 -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor.Copying constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Make this id matchLongObjectId.zeroId().private voidfromHexString(byte[] bs, int p) voidCopy a LongObjectId into this mutable buffer.voidfromRaw(byte[] bs) Convert a LongObjectId from raw binary representation.voidfromRaw(byte[] bs, int p) Convert a LongObjectId from raw binary representation.voidfromRaw(long[] longs) Convert a LongObjectId from binary representation expressed in integers.voidfromRaw(long[] longs, int p) Convert a LongObjectId from binary representation expressed in longs.voidfromString(byte[] buf, int offset) Convert a LongObjectId from hex characters (US-ASCII).voidfromString(String str) Convert a LongObjectId from hex characters.private static longset(long w, int index, long value) voidsetByte(int index, int value) Set any byte in the id.Obtain an immutable copy of this current object.Methods inherited from class org.eclipse.jgit.lfs.lib.AnyLongObjectId
abbreviate, compareTo, compareTo, compareTo, copy, copyRawTo, copyRawTo, copyRawTo, copyRawTo, copyTo, copyTo, copyTo, copyTo, copyTo, copyTo, equals, equals, equals, formatHexChar, getByte, getFirstByte, getName, getSecondByte, hashCode, isEqual, name, startsWith, toHexCharArray, toString
-
Constructor Details
-
MutableLongObjectId
public MutableLongObjectId()Empty constructor. Initialize object with default (zeros) value. -
MutableLongObjectId
MutableLongObjectId(MutableLongObjectId src) Copying constructor.- Parameters:
src- original entry, to copy id from
-
-
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.LONG_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.LONG_OBJECT_ID_LENGTH, or greater thanConstants.LONG_OBJECT_ID_LENGTH.
-
set
private static long set(long w, int index, long value) -
clear
public void clear()Make this id matchLongObjectId.zeroId(). -
fromObjectId
Copy a LongObjectId into this mutable buffer.- Parameters:
src- the source id to copy from.
-
fromRaw
public void fromRaw(byte[] bs) Convert a LongObjectId from raw binary representation.- Parameters:
bs- the raw byte buffer to read from. At least 32 bytes must be available within this byte array.
-
fromRaw
public void fromRaw(byte[] bs, int p) Convert a LongObjectId from raw binary representation.- Parameters:
bs- the raw byte buffer to read from. At least 32 bytes after p must be available within this byte array.p- position to read the first byte of data from.
-
fromRaw
public void fromRaw(long[] longs) Convert a LongObjectId from binary representation expressed in integers.- Parameters:
longs- the raw long buffer to read from. At least 4 longs must be available within this longs array.
-
fromRaw
public void fromRaw(long[] longs, int p) Convert a LongObjectId from binary representation expressed in longs.- Parameters:
longs- the raw int buffer to read from. At least 4 longs after p must be available within this longs array.p- position to read the first integer of data from.
-
fromString
public void fromString(byte[] buf, int offset) Convert a LongObjectId from hex characters (US-ASCII).- Parameters:
buf- the US-ASCII buffer to read from. At least 32 bytes after offset must be available within this byte array.offset- position to read the first character from.
-
fromString
Convert a LongObjectId from hex characters.- Parameters:
str- the string to read from. Must be 64 characters long.
-
fromHexString
private void fromHexString(byte[] bs, int p) -
toObjectId
Obtain an immutable copy of this current object.See
AnyLongObjectId.copy()ifthisis a possibly subclassed (but immutable) identity and the application needs a lightweight identity only reference.- Specified by:
toObjectIdin classAnyLongObjectId- Returns:
- an immutable copy. May be
thisif this is already an immutable instance.
-