Package com.yubico.webauthn.data
Class ByteArray
java.lang.Object
com.yubico.webauthn.data.ByteArray
- All Implemented Interfaces:
Comparable<ByteArray>
An immutable byte array with support for encoding/decoding to/from various encodings.
-
Constructor Summary
ConstructorDescriptionByteArray
(@lombok.NonNull byte[] bytes) Create a new instance by copying the contents ofbytes
. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
static ByteArray
fromBase64
(@NonNull String base64) Create a new instance by decodingbase64
as classic Base64 data.static ByteArray
fromBase64Url
(@NonNull String base64url) Create a new instance by decodingbase64url
as Base64Url data.static ByteArray
Create a new instance by decodinghex
as hexadecimal data.byte[]
getBytes()
getHex()
int
hashCode()
boolean
isEmpty()
int
size()
toString()
-
Constructor Details
-
ByteArray
public ByteArray(@NonNull @lombok.NonNull byte[] bytes) Create a new instance by copying the contents ofbytes
.
-
-
Method Details
-
fromBase64
Create a new instance by decodingbase64
as classic Base64 data. -
fromBase64Url
Create a new instance by decodingbase64url
as Base64Url data.- Throws:
Base64UrlException
- ifbase64url
is not valid Base64Url data.
-
fromHex
Create a new instance by decodinghex
as hexadecimal data.- Throws:
HexException
- ifhex
is not valid hexadecimal data.
-
concat
- Returns:
- a new instance containing a copy of this instance followed by a copy of
tail
.
-
isEmpty
public boolean isEmpty() -
size
public int size() -
getBytes
public byte[] getBytes()- Returns:
- a copy of the raw byte contents.
-
getBase64
- Returns:
- the content bytes encoded as classic Base64 data.
-
getBase64Url
- Returns:
- the content bytes encoded as Base64Url data, without padding.
-
getHex
- Returns:
- the content bytes encoded as hexadecimal data.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<ByteArray>
-
equals
-
hashCode
public int hashCode() -
toString
-