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 from ObjectId
Since:
4.3
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • ZEROID

      private static final LongObjectId ZEROID
    • ZEROID_STR

      private static final String ZEROID_STR
  • Constructor Details

    • LongObjectId

      LongObjectId(long new_1, long new_2, long new_3, long new_4)
    • 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 Details

    • 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.
    • fromHexString

      private static final LongObjectId fromHexString(byte[] bs, int p)
    • toObjectId

      public LongObjectId toObjectId()
      Obtain an immutable copy of this current object.

      See AnyLongObjectId.copy() if this is a possibly subclassed (but immutable) identity and the application needs a lightweight identity only reference.

      Specified by:
      toObjectId in class AnyLongObjectId
      Returns:
      an immutable copy. May be this if this is already an immutable instance.
    • writeObject

      private void writeObject(ObjectOutputStream os) throws IOException
      Throws:
      IOException
    • readObject

      private void readObject(ObjectInputStream ois) throws IOException
      Throws:
      IOException