Back to Vassonic

SonicUtils (sdk 3.0.0 API)

sonic-android/docs/javadoc/com/tencent/sonic/sdk/SonicUtils.html

3.1.16.6 KB
Original Source

跳过导航链接

com.tencent.sonic.sdk

类 SonicUtils

  • java.lang.Object

    • com.tencent.sonic.sdk.SonicUtils

public classSonicUtilsextends java.lang.Object

Sonic Utils

字段概要

字段 | 限定符和类型 | 字段和说明 | | --- | --- | | static java.lang.String | DEFAULT_CHARSET the default charset is UTF-8. |

构造器概要

构造器 | 构造器和说明 | | --- | | SonicUtils() |

方法概要

所有方法 静态方法 具体方法 | 限定符和类型 | 方法和说明 | | --- | --- | | static java.util.HashMap<java.lang.String,java.lang.String> | getFilteredHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> srcHeaders) Get filtered headers by session id, this method will return a map of header(k-v) which will not contains "Set-Cookie", "Cache-Control", "Expires". | | static java.lang.String | getMD5(java.lang.String content) | | static java.lang.String | getMime(java.lang.String url) Get mime type for url simply. | | static java.lang.String | getSHA1(byte[] contentBytes) | | static void | log(java.lang.String tag, int level, java.lang.String message) Logger function | | static void | removeResourceCache(java.lang.String resourceId) Remove a unique resource cache. | | static boolean | saveResourceFiles(java.lang.String resourceName, byte[] resourceBytes, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers) save resource files, including resource and headers. | | static void | saveSonicResourceData(java.lang.String resourceUrl, java.lang.String resourceSha1, long resourceSize) save resource data to database, such as resource sha1, resource size etc. | | static boolean | shouldLog(int level) Logger function |

- 

从类继承的方法 java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

字段详细资料

- 

DEFAULT_CHARSET

public static final java.lang.String DEFAULT_CHARSET

the default charset is UTF-8.

构造器详细资料

- 

SonicUtils

public SonicUtils()

方法详细资料

- 

shouldLog

public static boolean shouldLog(int level)

Logger function 参数:level - Level of this log,such like Log.DEBUG.返回:Should log or not

- 

log

public static void log(java.lang.String tag,
                       int level,
                       java.lang.String message)

Logger function 参数:tag - Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.level - Level of this log,such like Log.DEBUG.message - The message you would like logged.

- 

saveSonicResourceData

public static void saveSonicResourceData(java.lang.String resourceUrl,
                                         java.lang.String resourceSha1,
                                         long resourceSize)

save resource data to database, such as resource sha1, resource size etc. 参数:resourceUrl - the resource urlresourceSha1 - the resource sha1resourceSize - the resource size

- 

saveResourceFiles

public static boolean saveResourceFiles(java.lang.String resourceName,
                                        byte[] resourceBytes,
                                        java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)

save resource files, including resource and headers. 参数:resourceName - resource file nameresourceBytes - resource bytes contentheaders - resource headers返回:The result of save files. true if all data is saved successfully.

- 

getFilteredHeaders

public static java.util.HashMap<java.lang.String,java.lang.String> getFilteredHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> srcHeaders)

Get filtered headers by session id, this method will return a map of header(k-v) which will not contains "Set-Cookie", "Cache-Control", "Expires". 参数:srcHeaders - The source headers返回:The headers of sessionId

- 

removeResourceCache

public static void removeResourceCache(java.lang.String resourceId)

Remove a unique resource cache. 参数:resourceId - a unique resource id

- 

getMime

public static java.lang.String getMime(java.lang.String url)

Get mime type for url simply. (Maybe android.webkit.MimeTypeMap.getMimeTypeFromExtension is better.) 参数:url - target url返回:mime type

- 

getSHA1

public static java.lang.String getSHA1(byte[] contentBytes)
- 

getMD5

public static java.lang.String getMD5(java.lang.String content)

跳过导航链接