Package com.yubico.webauthn.data
Class ByteArray
- java.lang.Object
-
- com.yubico.webauthn.data.ByteArray
-
-
Constructor Summary
Constructors Constructor Description ByteArray(@lombok.NonNull byte[] bytes)
Create a new instance by copying the contents ofbytes
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(ByteArray other)
ByteArray
concat(@NonNull ByteArray tail)
boolean
equals(java.lang.Object o)
static ByteArray
fromBase64(@NonNull java.lang.String base64)
Create a new instance by decodingbase64
as classic Base64 data.static ByteArray
fromBase64Url(@NonNull java.lang.String base64url)
Create a new instance by decodingbase64url
as Base64Url data.static ByteArray
fromHex(@NonNull java.lang.String hex)
Create a new instance by decodinghex
as hexadecimal data.java.lang.String
getBase64()
java.lang.String
getBase64Url()
byte[]
getBytes()
java.lang.String
getHex()
int
hashCode()
boolean
isEmpty()
int
size()
java.lang.String
toString()
-
-
-
Method Detail
-
fromBase64
public static ByteArray fromBase64(@NonNull @NonNull java.lang.String base64)
Create a new instance by decodingbase64
as classic Base64 data.
-
fromBase64Url
public static ByteArray fromBase64Url(@NonNull @NonNull java.lang.String base64url) throws Base64UrlException
Create a new instance by decodingbase64url
as Base64Url data.- Throws:
Base64UrlException
- ifbase64url
is not valid Base64Url data.
-
fromHex
public static ByteArray fromHex(@NonNull @NonNull java.lang.String hex) throws HexException
Create a new instance by decodinghex
as hexadecimal data.- Throws:
HexException
- ifhex
is not valid hexadecimal data.
-
concat
public ByteArray concat(@NonNull @NonNull ByteArray tail)
- 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
public java.lang.String getBase64()
- Returns:
- the content bytes encoded as classic Base64 data.
-
getBase64Url
public java.lang.String getBase64Url()
- Returns:
- the content bytes encoded as Base64Url data, without padding.
-
getHex
public java.lang.String getHex()
- Returns:
- the content bytes encoded as hexadecimal data.
-
compareTo
public int compareTo(ByteArray other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<ByteArray>
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-