public class SFBinary extends Object
| Modifier and Type | Field and Description |
|---|---|
static SFBinary |
EMPTY
An empty SFBinary.
|
static SFBinary |
MAXIMUM
Special SFBinary that is greater than all others.
|
| Constructor and Description |
|---|
SFBinary(byte[] bytes)
Constructs an SFBinary from a byte array.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(SFBinary other)
Compares SFBinary
|
SFBinary |
concat(SFBinary other)
Concatenates two binary values.
|
boolean |
equals(Object other) |
static SFBinary |
fromBase64(String str)
Creates an SFBinary by decoding a Base64-encoded string (RFC 4648).
|
static SFBinary |
fromHex(String str)
Creates an SFBinary by decoding a hex-encoded string (uppercase letters).
|
byte[] |
getBytes()
Returns the underlying byte array.
|
int |
hashCode() |
int |
length()
Returns the length of the SFBinary in bytes.
|
SFBinary |
substring(int start,
int end)
Returns a new SFBinary that is a substring of this SFBinary.
|
String |
toBase64()
Encodes the binary value as a Base64 string (RFC 4648).
|
String |
toHex()
Encodes the binary value as a hex string (uppercase letters).
|
String |
toString() |
static boolean |
validHex(String str)
Returns true if it's safe to call SFBinary.fromHex(str).
|
public static final SFBinary EMPTY
public static final SFBinary MAXIMUM
public SFBinary(byte[] bytes)
bytes - an byte arraypublic static boolean validHex(String str)
str - a stringpublic static SFBinary fromHex(String str)
str - a stringIllegalArgumentException - if the string is not hex-encoded.public static SFBinary fromBase64(String str)
str - a string.IllegalArgumentException - if the string is not Base64-encoded.public byte[] getBytes()
public int length()
public String toHex()
public String toBase64()
public SFBinary substring(int start, int end)
start - the starting index of byte arrayend - the ending index of byte arraypublic SFBinary concat(SFBinary other)
other - SFBinary to appendpublic int compareTo(SFBinary other)
other - the target SFBinaryCopyright © 2020. All rights reserved.