public class Util
extends java.lang.Object
note: For some reason we need to make it public, but I don't recommend to use it directly.
Modifier and Type | Class and Description |
---|---|
static interface |
Util.XdrDecodeFunction<T,R>
The function that converts XDR string to XDR object.
|
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static AssetTypeCreditAlphaNum |
assertNonNativeAsset(Asset asset)
Throws
IllegalArgumentException if the given asset is native (XLM). |
static java.lang.String |
bytesToHex(byte[] bytes)
Returns hex representation of
bytes array. |
static byte[] |
getBytes(java.math.BigInteger value)
Returns an 8 byte array representation of a BigInteger value.
|
static java.lang.String |
getSdkVersion()
Get the version of the SDK
|
static byte[] |
hash(byte[] data)
Returns SHA-256 hash of
data . |
static byte[] |
hexToBytes(java.lang.String s)
Returns byte array representation of
hex string. |
static byte[] |
paddedByteArray(java.lang.String string,
int length)
Pads
string to length with zeros. |
static <T> T |
parseXdr(java.lang.String xdr,
Util.XdrDecodeFunction<java.lang.String,T> fromXdrBase64)
Parses XDR string to XDR object.
|
public static java.lang.String bytesToHex(byte[] bytes)
bytes
array.bytes
- byte array to convert to hexpublic static byte[] hexToBytes(java.lang.String s)
hex
string.s
- hex string to convert to byte arraypublic static byte[] hash(byte[] data)
data
.data
- byte array to hashpublic static byte[] paddedByteArray(java.lang.String string, int length)
string
to length
with zeros.string
- string to padlength
- length of the resulting arraypublic static java.lang.String getSdkVersion()
public static AssetTypeCreditAlphaNum assertNonNativeAsset(Asset asset)
IllegalArgumentException
if the given asset is native (XLM).asset
- The asset to checkpublic static byte[] getBytes(java.math.BigInteger value)
value
- BigInteger value to convert to byte arraypublic static <T> T parseXdr(java.lang.String xdr, Util.XdrDecodeFunction<java.lang.String,T> fromXdrBase64)
T
- type of XDR objectxdr
- XDR stringfromXdrBase64
- function that converts XDR string to XDR object