Package land.oras.utils
Enum Class SupportedAlgorithm
- All Implemented Interfaces:
Serializable
,Comparable<SupportedAlgorithm>
,Constable
Supported algorithms for digest.
See @link https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests
See @link https://github.com/opencontainers/image-spec/blob/main/descriptor.md#registered-algorithms
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptiondigest
(byte[] bytes) Digest a byte arraydigest
(InputStream inputStream) Digest an input streamDigest a filestatic SupportedAlgorithm
fromDigest
(String digest) Get the algorithm from a digestGet the algorithmstatic SupportedAlgorithm
Get the default algorithmstatic String
Return the digest without the prefixGet the prefixstatic boolean
isSupported
(String digest) Check if the digest is supportedstatic boolean
matchPattern
(String digest) Check if the algorithm match patternstatic SupportedAlgorithm
Returns the enum constant of this class with the specified name.static SupportedAlgorithm[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SHA256
SHA-256 -
SHA512
SHA-512 -
BLAKE3
BLAKE3
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getPrefix
Get the prefix- Returns:
- The prefix
-
getAlgorithmName
Get the algorithm- Returns:
- The algorithm
-
digest
Digest a byte array- Parameters:
bytes
- The bytes- Returns:
- The digest
-
digest
Digest a file- Parameters:
file
- The file- Returns:
- The digest
-
digest
Digest an input stream- Parameters:
inputStream
- The input stream- Returns:
- The digest
-
matchPattern
Check if the algorithm match pattern- Parameters:
digest
- The digest- Returns:
- True if supported
-
isSupported
Check if the digest is supported- Parameters:
digest
- The digest- Returns:
- True if supported
-
fromDigest
Get the algorithm from a digest- Parameters:
digest
- The digest- Returns:
- The algorithm
-
getDefault
Get the default algorithm- Returns:
- The default algorithm
-
getDigest
Return the digest without the prefix- Parameters:
digest
- The digest- Returns:
- The digest without the prefix
-