Package org.eclipse.jgit.lfs.lib
Class LongObjectId
java.lang.Object
org.eclipse.jgit.lfs.lib.AnyLongObjectId
org.eclipse.jgit.lfs.lib.LongObjectId
- All Implemented Interfaces:
Serializable
,Comparable<AnyLongObjectId>
A SHA-256 abstraction.
Ported to SHA-256 from
ObjectId
- Since:
- 4.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
private static final LongObjectId
private static final String
Fields inherited from class org.eclipse.jgit.lfs.lib.AnyLongObjectId
w1, w2, w3, w4
-
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
LongObjectId
(long new_1, long new_2, long new_3, long new_4) protected
Initialize this instance by copying another existing LongObjectId. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
equals
(byte[] firstBuffer, int fi, byte[] secondBuffer, int si) Compare two object identifier byte sequences for equality.private static final LongObjectId
fromHexString
(byte[] bs, int p) static final LongObjectId
fromRaw
(byte[] bs) Convert a LongObjectId from raw binary representation.static final LongObjectId
fromRaw
(byte[] bs, int p) Convert a LongObjectId from raw binary representation.static final LongObjectId
fromRaw
(long[] is) Convert a LongObjectId from raw binary representation.static final LongObjectId
fromRaw
(long[] is, int p) Convert a LongObjectId from raw binary representation.static final LongObjectId
fromString
(byte[] buf, int offset) Convert a LongObjectId from hex characters (US-ASCII).static LongObjectId
fromString
(String str) Convert a LongObjectId from hex characters.static final boolean
Test a string of characters to verify that it can be interpreted as LongObjectId.private void
Obtain an immutable copy of this current object.static final String
Convert a LongObjectId into a hex string representation.private void
static final LongObjectId
zeroId()
Get the special all-zero LongObjectId.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
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
ZEROID
-
ZEROID_STR
-
-
Constructor Details
-
LongObjectId
LongObjectId(long new_1, long new_2, long new_3, long new_4) -
LongObjectId
Initialize this instance by copying another existing LongObjectId.This constructor is mostly useful for subclasses which want to extend a LongObjectId with more properties, but initialize from an existing LongObjectId instance acquired by other means.
- Parameters:
src
- another already parsed LongObjectId to copy the value out of.
-
-
Method Details
-
zeroId
Get the special all-zero LongObjectId.- Returns:
- the all-zero LongObjectId, often used to stand-in for no object.
-
isId
Test a string of characters to verify that it can be interpreted as LongObjectId.If true the string can be parsed with
fromString(String)
.- Parameters:
id
- the string to test.- Returns:
- true if the string can converted into an LongObjectId.
-
toString
Convert a LongObjectId into a hex string representation.- Parameters:
i
- the id to convert. May be null.- Returns:
- the hex string conversion of this id's content.
-
equals
public static boolean equals(byte[] firstBuffer, int fi, byte[] secondBuffer, int si) Compare two object identifier byte sequences for equality.- Parameters:
firstBuffer
- the first buffer to compare against. Must have at least 32 bytes from position fi through the end of the buffer.fi
- first offset within firstBuffer to begin testing.secondBuffer
- the second buffer to compare against. Must have at least 32 bytes from position si through the end of the buffer.si
- first offset within secondBuffer to begin testing.- Returns:
- true if the two identifiers are the same.
-
fromRaw
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.- Returns:
- the converted object id.
-
fromRaw
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.- Returns:
- the converted object id.
-
fromRaw
Convert a LongObjectId from raw binary representation.- Parameters:
is
- the raw long buffer to read from. At least 4 longs must be available within this long array.- Returns:
- the converted object id.
-
fromRaw
Convert a LongObjectId from raw binary representation.- Parameters:
is
- the raw long buffer to read from. At least 4 longs after p must be available within this long array.p
- position to read the first long of data from.- Returns:
- the converted object id.
-
fromString
Convert a LongObjectId from hex characters (US-ASCII).- Parameters:
buf
- the US-ASCII buffer to read from. At least 64 bytes after offset must be available within this byte array.offset
- position to read the first character from.- Returns:
- the converted object id.
-
fromString
Convert a LongObjectId from hex characters.- Parameters:
str
- the string to read from. Must be 64 characters long.- Returns:
- the converted object id.
-
fromHexString
-
toObjectId
Obtain an immutable copy of this current object.See
AnyLongObjectId.copy()
ifthis
is a possibly subclassed (but immutable) identity and the application needs a lightweight identity only reference.- Specified by:
toObjectId
in classAnyLongObjectId
- Returns:
- an immutable copy. May be
this
if this is already an immutable instance.
-
writeObject
- Throws:
IOException
-
readObject
- Throws:
IOException
-