Package com.nimbusds.jose.util
Class Base64
java.lang.Object
com.nimbusds.jose.util.Base64
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Base64URL
Base64-encoded object.
- Version:
- 2024-04-20
- Author:
- Vladimir Dzhuvinov
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
decode()
Decodes this Base64 object to a byte array.Decodes this Base64 object to an unsigned big integer.Decodes this Base64 object to a string.static Base64
encode
(byte[] bytes) Base64-encodes the specified byte array.static Base64
Base64-encodes the specified string.static Base64
encode
(BigInteger bigInt) Base64-encodes the specified big integer, without the sign bit.boolean
OverridesObject.equals()
.static Base64
Creates a new Base64-encoded object from the specified string.int
hashCode()
OverridesObject.hashCode()
.Returns a JSON string representation of this object.toString()
Returns a Base64 string representation of this object.
-
Constructor Details
-
Base64
Creates a new Base64-encoded object.- Parameters:
base64
- The Base64-encoded object value. The value is not validated for having characters from a Base64 alphabet. Must not benull
.
-
-
Method Details
-
decode
Decodes this Base64 object to a byte array.- Returns:
- The resulting byte array.
-
decodeToBigInteger
Decodes this Base64 object to an unsigned big integer.Same as
new BigInteger(1, base64.decode())
.- Returns:
- The resulting big integer.
-
decodeToString
Decodes this Base64 object to a string.- Returns:
- The resulting string, in the UTF-8 character set.
-
toJSONString
Returns a JSON string representation of this object.- Returns:
- The JSON string representation of this object.
-
toString
Returns a Base64 string representation of this object. The string will be chunked into 76 character blocks separated by CRLF. -
hashCode
OverridesObject.hashCode()
. -
equals
OverridesObject.equals()
. -
from
Creates a new Base64-encoded object from the specified string.- Parameters:
base64
- The Base64-encoded object value,null
if not specified. The value is not validated for having characters from the Base64 alphabet.- Returns:
- The Base64-encoded object,
null
if not specified.
-
encode
Base64-encodes the specified byte array.- Parameters:
bytes
- The byte array to encode. Must not benull
.- Returns:
- The resulting Base64 object.
-
encode
Base64-encodes the specified big integer, without the sign bit.- Parameters:
bigInt
- The big integer to encode. Must not benull
.- Returns:
- The resulting Base64 object.
-
encode
Base64-encodes the specified string.- Parameters:
text
- The string to encode. Must be in the UTF-8 character set and notnull
.- Returns:
- The resulting Base64 object.
-