public class Encoder extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Encoder.DaraBase64 |
| Modifier and Type | Field and Description |
|---|---|
static String |
ENCODING |
static String |
HASH_SHA256 |
static String |
HASH_SM3 |
static String |
HMAC_SHA256 |
static String |
HMAC_SM3 |
static String |
RSA_SHA256 |
| Constructor and Description |
|---|
Encoder() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
base64Decode(String src)
Base64 encoder for string.
|
static String |
base64EncodeToString(byte[] raw)
Base64 encoder for byte array.
|
static byte[] |
hash(byte[] raw,
String signatureAlgorithm)
Hash the raw data with signatureAlgorithm.
|
static String |
hexEncode(byte[] raw)
Hex encode for byte array.
|
static String |
pathEncode(String path)
Encode the partial path of url.
|
static String |
percentEncode(String raw)
Special encoding for url params.
|
static String |
urlEncode(String url)
Encode the URL
|
public static final String ENCODING
public static final String HASH_SHA256
public static final String HASH_SM3
public static final String HMAC_SHA256
public static final String RSA_SHA256
public static final String HMAC_SM3
public static String urlEncode(String url) throws UnsupportedEncodingException
url - stringUnsupportedEncodingExceptionpublic static String percentEncode(String raw) throws UnsupportedEncodingException
raw - stringUnsupportedEncodingExceptionpublic static String pathEncode(String path) throws Exception
path - stringExceptionpublic static String hexEncode(byte[] raw)
raw - byte arraypublic static byte[] hash(byte[] raw,
String signatureAlgorithm)
throws Exception
raw - hashing datasignatureAlgorithm - the autograph methodExceptionpublic static String base64EncodeToString(byte[] raw) throws Exception
raw - byte arrayExceptionCopyright © 2022. All rights reserved.