Class Hash

  • All Implemented Interfaces:
    Ref

    public abstract class Hash
    extends java.lang.Object
    implements Ref
    Describes a specific point in time/history. Internally is a binary value but a string representation is available.
    • Constructor Summary

      Constructors 
      Constructor Description
      Hash()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract org.projectnessie.nessie.relocated.protobuf.ByteString asBytes()
      Gets the bytes representation of the hash.
      abstract java.lang.String asString()
      Generates a string representation of the hash suitable to be used with of(String).
      abstract int nibbleAt​(int nibbleIndex)
      Retrieve the nibble (4 bit part) at the given index.
      static Hash of​(java.lang.String hash)
      Creates a hash instance from its string representation.
      static Hash of​(org.projectnessie.nessie.relocated.protobuf.ByteString bytes)
      Creates a hash instance from its bytes' representation.
      abstract int size()
      Return the size of the hash in bytes.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Hash

        public Hash()
    • Method Detail

      • asString

        public abstract java.lang.String asString()
        Generates a string representation of the hash suitable to be used with of(String).
      • asBytes

        public abstract org.projectnessie.nessie.relocated.protobuf.ByteString asBytes()
        Gets the bytes representation of the hash.
        Returns:
        the hash's bytes
      • nibbleAt

        public abstract int nibbleAt​(int nibbleIndex)
        Retrieve the nibble (4 bit part) at the given index.

        This retrieves the 4-bit value of the hex character from asString() at the same index..

      • size

        public abstract int size()
        Return the size of the hash in bytes.
      • of

        public static Hash of​(@Nonnull @Nonnull
                              java.lang.String hash)
        Creates a hash instance from its string representation.
        Parameters:
        hash - the string representation of the hash
        Returns:
        a Hash instance
        Throws:
        java.lang.IllegalArgumentException - if hash is not a valid representation of a hash
        java.lang.NullPointerException - if hash is null
      • of

        public static Hash of​(@Nonnull @Nonnull
                              org.projectnessie.nessie.relocated.protobuf.ByteString bytes)
        Creates a hash instance from its bytes' representation.
        Parameters:
        bytes - the bytes' representation of the hash
        Returns:
        a Hash instance
        Throws:
        java.lang.NullPointerException - if hash is null
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object