Back to Vassonic

SonicEngine (sdk 3.0.0 API)

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

3.1.110.0 KB
Original Source

跳过导航链接

com.tencent.sonic.sdk

类 SonicEngine

  • java.lang.Object

    • com.tencent.sonic.sdk.SonicEngine

public classSonicEngineextends java.lang.Object

Interacts with the overall SonicSessions running in the system. Instances of this class can be used to query or fetch the information, such as SonicSession SonicRuntime.

方法概要

所有方法 静态方法 实例方法 具体方法 | 限定符和类型 | 方法和说明 | | --- | --- | | boolean | cleanCache() Removes all of the cache from preloadSessionPool and deletes file caches from SDCard. | | static SonicEngine | createInstance(SonicRuntime runtime, SonicConfig config) Create SonicEngine instance. | | SonicSession | createSession(java.lang.String url, SonicSessionConfig sessionConfig) | | SonicConfig | getConfig() | | static SonicEngine | getInstance() Returns a SonicEngine instance Make sure createInstance(SonicRuntime, SonicConfig) has been called. | | SonicRuntime | getRuntime() | | void | initSonicDB() Init sonic DB which will upgrade to new version of database. | | static boolean | isGetInstanceAllowed() Check if getInstance() is ready or not. | | boolean | isSonicAvailable() Whether Sonic Service is available or not | | static java.lang.String | makeSessionId(java.lang.String url, boolean isAccountRelated) Create session ID | | boolean | preCreateSession(java.lang.String url, SonicSessionConfig sessionConfig) This method will preCreate sonic session . | | boolean | removeSessionCache(java.lang.String sessionId) Removes the sessionId and its corresponding SonicSession from preloadSessionPool. | | void | trimSonicCache() It will Post a task to trim sonic cache if the last time of check sonic cache exceed SonicConfig.SONIC_CACHE_CHECK_TIME_INTERVAL. |

- 

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

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

方法详细资料

- 

getInstance

public static[SonicEngine](../../../../com/tencent/sonic/sdk/SonicEngine.html "com.tencent.sonic.sdk中的类")getInstance()

Returns a SonicEngine instance

Make sure createInstance(SonicRuntime, SonicConfig) has been called.

返回:SonicEngine instance抛出:java.lang.IllegalStateException - if createInstance(SonicRuntime, SonicConfig) hasn't been called

- 

isGetInstanceAllowed

public static boolean isGetInstanceAllowed()

Check if getInstance() is ready or not.

Note: createInstance(SonicRuntime, SonicConfig) must be called if false is returned.

返回:Return true if sInstance is not null, false otherwise

- 

createInstance

public static[SonicEngine](../../../../com/tencent/sonic/sdk/SonicEngine.html "com.tencent.sonic.sdk中的类")createInstance(@NonNull[SonicRuntime](../../../../com/tencent/sonic/sdk/SonicRuntime.html "com.tencent.sonic.sdk中的类")runtime,
                                         @NonNull[SonicConfig](../../../../com/tencent/sonic/sdk/SonicConfig.html "com.tencent.sonic.sdk中的类")config)

Create SonicEngine instance. Meanwhile it will initialize engine and SonicRuntime. 参数:runtime - SonicRuntimeconfig - SonicConfig返回:SonicEngine object

- 

initSonicDB

public void initSonicDB()

Init sonic DB which will upgrade to new version of database.

- 

getRuntime

public[SonicRuntime](../../../../com/tencent/sonic/sdk/SonicRuntime.html "com.tencent.sonic.sdk中的类")getRuntime()

返回:SonicRuntime object

- 

getConfig

public[SonicConfig](../../../../com/tencent/sonic/sdk/SonicConfig.html "com.tencent.sonic.sdk中的类")getConfig()

返回:SonicConfig object

- 

isSonicAvailable

public boolean isSonicAvailable()

Whether Sonic Service is available or not 返回:return true if Sonic Service is available , false else others.

- 

makeSessionId

public static java.lang.String makeSessionId(java.lang.String url,
                                             boolean isAccountRelated)

Create session ID 参数:url - session urlisAccountRelated - Session Id will contain SonicRuntime.getCurrentUserAccount() if isAccountRelated is true.返回:String Object of session ID

- 

preCreateSession

public boolean preCreateSession(@NonNull
                                java.lang.String url,
                                @NonNull[SonicSessionConfig](../../../../com/tencent/sonic/sdk/SonicSessionConfig.html "com.tencent.sonic.sdk中的类")sessionConfig)

This method will preCreate sonic session . And maps the specified session id to the specified value in this table preloadSessionPool if there is no same sonic session. At the same time, if the number of preloadSessionPool exceeds SonicConfig.MAX_PRELOAD_SESSION_COUNT, preCreateSession will return false and not create any sonic session.

Note: this method is intended for preload scene.

参数:url - url for preCreate sonic sessionsessionConfig - SonicSession config返回:If this method preCreate sonic session and associated with sessionId in this table preloadSessionPool successfully, it will return true, false otherwise.

- 

createSession

public[SonicSession](../../../../com/tencent/sonic/sdk/SonicSession.html "com.tencent.sonic.sdk中的类")createSession(@NonNull
                                  java.lang.String url,
                                  @NonNull[SonicSessionConfig](../../../../com/tencent/sonic/sdk/SonicSessionConfig.html "com.tencent.sonic.sdk中的类")sessionConfig)

参数:url - url for SonicSession ObjectsessionConfig - SSonicSession config返回:This method will create and return SonicSession Object when url is legal.

- 

cleanCache

public boolean cleanCache()

Removes all of the cache from preloadSessionPool and deletes file caches from SDCard. 返回:Returns false if runningSessionHashMap is not empty. Returns true if all of the local file cache has been deleted, false otherwise

- 

removeSessionCache

public boolean removeSessionCache(@NonNull
                                  java.lang.String sessionId)

Removes the sessionId and its corresponding SonicSession from preloadSessionPool. 参数:sessionId - A unique session id返回:Return true If there is no specified sessionId in runningSessionHashMap, false otherwise.

- 

trimSonicCache

public void trimSonicCache()

It will Post a task to trim sonic cache if the last time of check sonic cache exceed SonicConfig.SONIC_CACHE_CHECK_TIME_INTERVAL.

跳过导航链接