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>
public class LongObjectId extends AnyLongObjectId implements Serializable
A SHA-256 abstraction. Ported to SHA-256 fromObjectId
- Since:
- 4.3
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LongObjectId(AnyLongObjectId src)
Initialize this instance by copying another existing LongObjectId.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
equals(byte[] firstBuffer, int fi, byte[] secondBuffer, int si)
Compare two object identifier byte sequences for equality.static LongObjectId
fromRaw(byte[] bs)
Convert a LongObjectId from raw binary representation.static LongObjectId
fromRaw(byte[] bs, int p)
Convert a LongObjectId from raw binary representation.static LongObjectId
fromRaw(long[] is)
Convert a LongObjectId from raw binary representation.static LongObjectId
fromRaw(long[] is, int p)
Convert a LongObjectId from raw binary representation.static 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 boolean
isId(String id)
Test a string of characters to verify that it can be interpreted as LongObjectId.LongObjectId
toObjectId()
Obtain an immutable copy of this current object.static String
toString(LongObjectId i)
Convert a LongObjectId into a hex string representation.static 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, getByte, getFirstByte, getName, getSecondByte, hashCode, isEqual, name, startsWith, toString
-
-
-
-
Constructor Detail
-
LongObjectId
protected LongObjectId(AnyLongObjectId src)
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 Detail
-
zeroId
public static final LongObjectId zeroId()
Get the special all-zero LongObjectId.- Returns:
- the all-zero LongObjectId, often used to stand-in for no object.
-
isId
public static final boolean isId(String id)
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
public static final String toString(LongObjectId i)
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
public static final LongObjectId 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.- Returns:
- the converted object id.
-
fromRaw
public static final LongObjectId 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.- Returns:
- the converted object id.
-
fromRaw
public static final LongObjectId fromRaw(long[] is)
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
public static final LongObjectId fromRaw(long[] is, int p)
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
public static final LongObjectId fromString(byte[] buf, int offset)
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
public static LongObjectId fromString(String str)
Convert a LongObjectId from hex characters.- Parameters:
str
- the string to read from. Must be 64 characters long.- Returns:
- the converted object id.
-
toObjectId
public LongObjectId 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.
-
-