public class Common extends Object
| 构造器和说明 |
|---|
Common() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Map<String,Object> |
anyifyMapValue(Map<String,?> map)
Anyify the value of map
|
static Map<String,Object> |
assertAsMap(Object object)
Assert a value, if it is a map, return it, otherwise throws
|
static Number |
defaultNumber(Number number,
Number defaultNumber)
If not set the real, use default value
|
static String |
defaultString(String str,
String defaultStr)
If not set the real, use default value
|
static boolean |
empty(String str)
Check the string is empty?
|
static boolean |
equalNumber(Number num,
Number val)
Check one number equals another one?
|
static boolean |
equalString(String str,
String val)
Check one string equals another one?
|
static String |
getDateUTCString()
Get an UTC format string by current date, e.g.
|
static String |
getNonce()
Generate a nonce string
|
static String |
getUserAgent(String val)
Get user agent, if it userAgent is not null, splice it with defaultUserAgent and return, otherwise return defaultUserAgent
|
static boolean |
is2xx(Number code)
If the code between 200 and 300, return true, or return false
|
static boolean |
is3xx(Number code)
If the code between 300 and 400, return true, or return false
|
static boolean |
is4xx(Number code)
If the code between 400 and 500, return true, or return false
|
static boolean |
is5xx(Number code)
If the code between 500 and 600, return true, or return false
|
static boolean |
isUnset(Object object)
Check one value is unset
|
static Object |
parseJSON(String json)
Parse it by JSON format
|
static byte[] |
readAsBytes(InputStream stream)
Read data from a readable stream, and compose it to a bytes
|
static Object |
readAsJSON(InputStream stream)
Read data from a readable stream, and parse it by JSON format
|
static String |
readAsString(InputStream stream)
Read data from a readable stream, and compose it to a string
|
static Map<String,String> |
stringifyMapValue(Map<String,?> map)
Stringify the value of map
|
static byte[] |
toBytes(String str)
Convert a string(utf8) to bytes
|
static String |
toFormString(Map<String,?> map)
Format a map to form string, like a=a%20b%20c
|
static String |
toJSONString(Object object)
If not set the real, use default value
|
static Map<String,Object> |
toMap(com.aliyun.tea.TeaModel in)
Model transforms to map[string]any
|
static String |
toString(byte[] bytes)
Convert a bytes to string(utf8)
|
static void |
validateModel(com.aliyun.tea.TeaModel m)
Validate model
|
public static byte[] toBytes(String str) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic static String toString(byte[] bytes) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic static Map<String,Object> assertAsMap(Object object)
public static byte[] readAsBytes(InputStream stream) throws IOException
stream - the readable streamIOExceptionpublic static String readAsString(InputStream stream) throws IOException
stream - the readable streamIOExceptionpublic static Object readAsJSON(InputStream stream) throws IOException
stream - the readable streamIOExceptionpublic static String getNonce()
public static String getDateUTCString()
public static String defaultString(String str, String defaultStr)
public static Number defaultNumber(Number number, Number defaultNumber)
public static String toFormString(Map<String,?> map) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic static String toJSONString(Object object)
public static boolean empty(String str)
public static boolean equalString(String str, String val)
public static boolean equalNumber(Number num, Number val)
public static boolean isUnset(Object object)
public static Map<String,String> stringifyMapValue(Map<String,?> map)
public static Map<String,Object> anyifyMapValue(Map<String,?> map)
public static String getUserAgent(String val) throws Exception
Exceptionpublic static boolean is2xx(Number code) throws Exception
Exceptionpublic static boolean is3xx(Number code) throws Exception
Exceptionpublic static boolean is4xx(Number code) throws Exception
Exceptionpublic static boolean is5xx(Number code) throws Exception
Exceptionpublic static void validateModel(com.aliyun.tea.TeaModel m)
throws Exception
ExceptionCopyright © 2020. All rights reserved.