public final class JsBinary extends JsPrimitive
byte[] bytes = "foo".getBytes();
String base64 = Base64.getEncoder().encodeToString(bytes);
JsBinary.of(bytes).equals(JsStr.of(base64)); // true
Modifier and Type | Field and Description |
---|---|
static fun.optic.Prism<JsValue,byte[]> |
prism
prism between the sum type JsValue and JsBinary
|
static int |
TYPE_ID |
byte[] |
value |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
hashCode() |
int |
id() |
boolean |
isBinary()
Returns true if this JsValue is a JsBinary or a JsString which value is an array of
|
static JsBinary |
of(byte[] bytes)
Creates a JsBinary from an array of bytes
|
static JsBinary |
of(String base64)
Creates a JsBinary from an array of bytes encoded as a string in base64
|
JsPrimitive |
toJsPrimitive() |
String |
toString() |
isJson, isPrimitive
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
ifNothing, ifNull, isArray, isArray, isBigDec, isBigDec, isBigInt, isBigInt, isBool, isDecimal, isDouble, isDouble, isFalse, isInstant, isInstant, isInt, isInt, isIntegral, isJson, isLong, isLong, isNothing, isNotNothing, isNotNull, isNotNumber, isNull, isNumber, isObj, isObj, isSameType, isStr, isStr, isTrue, toJsArray, toJsBigDec, toJsBigInt, toJsBinary, toJsBool, toJsDouble, toJsInstant, toJsInt, toJsLong, toJsNumber, toJsObj, toJson, toJsStr
public static final int TYPE_ID
public static final fun.optic.Prism<JsValue,byte[]> prism
public final byte[] value
public static JsBinary of(byte[] bytes)
bytes
- the array of bytespublic static JsBinary of(String base64)
base64
- the stringIllegalArgumentException
- if base64
is not in valid Base64 schemepublic int id()
public JsPrimitive toJsPrimitive()
public boolean isBinary()
JsValue
Copyright © 2022. All rights reserved.