Package org.projectnessie.versioned
Class Hash
- java.lang.Object
-
- org.projectnessie.versioned.Hash
-
-
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.ByteStringasBytes()Gets the bytes representation of the hash.abstract java.lang.StringasString()Generates a string representation of the hash suitable to be used withof(String).abstract intnibbleAt(int nibbleIndex)Retrieve the nibble (4 bit part) at the given index.static Hashof(java.lang.String hash)Creates a hash instance from its string representation.static Hashof(org.projectnessie.nessie.relocated.protobuf.ByteString bytes)Creates a hash instance from its bytes' representation.abstract intsize()Return the size of the hash in bytes.java.lang.StringtoString()
-
-
-
Method Detail
-
asString
public abstract java.lang.String asString()
Generates a string representation of the hash suitable to be used withof(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
Hashinstance - Throws:
java.lang.IllegalArgumentException- ifhashis not a valid representation of a hashjava.lang.NullPointerException- ifhashisnull
-
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
Hashinstance - Throws:
java.lang.NullPointerException- ifhashisnull
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-