public class Util extends Object
| 构造器和说明 |
|---|
Util() |
| 限定符和类型 | 方法和说明 |
|---|---|
static List<String> |
array(String val0,
String... vals)
String Parameters to List of String
|
static String |
bytesToHex(byte[] bytes)
Transfer byte array to Hex String
|
static int |
bytesToInt(byte[] src)
byte数组中取int数值,本方法适用于(低位在前,高位在后)的顺序,和和intToBytes()配套使用
|
static void |
decryptData(byte[] pass,
org.json.JSONObject tx)
unhex some fields
|
static String |
encryptRaw(Connection connection,
String token,
String strRaw) |
static org.json.JSONObject |
errorObject(String errMsg) |
static String |
fromHexString(String s)
Transfer from HexString to String
|
static Amount |
getExtraFee(org.json.JSONObject json,
int drops_per_byte,
TransactionType type)
获取交易的额外的费用
|
static String |
getNewAccountFromTx(org.json.JSONObject tx) |
static String |
getPublicHexFromSecret(String secret) |
static byte[] |
getRandomBytes(int length)
Get random byte array.
|
static String |
getUserToken(Connection connection,
String address,
String name) |
static byte[] |
hexToBytes(String bytes)
Hex String to byte array.
|
static byte[] |
intToBytes(int value)
将int数值转换为占四个字节的byte数组,本方法适用于(低位在前,高位在后)的顺序。
|
static boolean |
isChainsqlType(TransactionType type) |
static org.json.JSONArray |
listToJSONArray(List<String> accounts)
Transform list to JSONArray
|
static List<org.json.JSONObject> |
ListToJsonList(List<String> list)
Transfer a JSON-str List to a JSONObject List.
|
static byte[] |
paddingPass(byte[] password,
int keyLength) |
static byte[] |
sign(byte[] message,
String secret)
签名接口
|
static org.json.JSONObject |
StrToJson(String args)
Transfer a json-str to JSONObject.
|
static org.json.JSONArray |
strToJSONArray(String str)
JSON-Str to JSONArray
|
static String |
StrToJsonStr(String args) |
static org.json.JSONObject |
successObject() |
static String |
toHexString(String s)
String to HexString
|
static void |
unHexData(org.json.JSONObject tx)
unhex some fields
|
static boolean |
verify(byte[] message,
byte[] signature,
String publicKey)
验证签名接口
|
static void |
waiting()
Wait for 50 milliseconds.
|
public static org.json.JSONObject StrToJson(String args)
args - String of JSON.public static List<org.json.JSONObject> ListToJsonList(List<String> list)
list - JSON String list.public static org.json.JSONArray strToJSONArray(String str)
str - JSON Stringpublic static org.json.JSONArray listToJSONArray(List<String> accounts)
accounts - accountspublic static byte[] getRandomBytes(int length)
length - Random array length.public static String bytesToHex(byte[] bytes)
bytes - Byte array to be hexed.public static byte[] hexToBytes(String bytes)
bytes - hexStringpublic static String toHexString(String s)
s - String to be hexed.public static String fromHexString(String s)
s - Hex String.public static byte[] paddingPass(byte[] password,
int keyLength)
public static List<String> array(String val0, String... vals)
val0 - Stringvals - Stringpublic static void unHexData(org.json.JSONObject tx)
tx - JSONObject to be unhexed.public static void decryptData(byte[] pass,
org.json.JSONObject tx)
pass - Secret used to decrypttx - JSONObject to be unhexed.public static void waiting()
public static org.json.JSONObject successObject()
public static org.json.JSONObject errorObject(String errMsg)
public static byte[] intToBytes(int value)
value - 要转换的int值public static int bytesToInt(byte[] src)
src - byte数组public static boolean isChainsqlType(TransactionType type)
public static Amount getExtraFee(org.json.JSONObject json, int drops_per_byte, TransactionType type)
json - 交易jsondrops_per_byte - 每字节消耗多少dropstype - 交易类别public static String getNewAccountFromTx(org.json.JSONObject tx)
public static byte[] sign(byte[] message,
String secret)
message - 要签名的内容secret - 签名私钥public static boolean verify(byte[] message,
byte[] signature,
String publicKey)
message - 被签名的内容signature - 签名publicKey - 签名公钥public static String getUserToken(Connection connection, String address, String name) throws Exception
ExceptionCopyright © 2021. All rights reserved.