crystalspace.jbind.impl.csutil.cache
Class csCacheManager

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csutil.scf.csBase
          extended bycrystalspace.jbind.impl.csutil.cache.csCacheManager
All Implemented Interfaces:
iBase, iCacheManager, iPointer

public class csCacheManager
extends csBase
implements iCacheManager

Author:
Quentin Anciaux

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csCacheManager(iPointer nPointer)
           
 
Method Summary
 boolean cacheData(iPointer data, int size, java.lang.String type, java.lang.String scope, int id)
          Cache some data.
 boolean clearCache()
          Clear items from the cache.
 boolean clearCache(java.lang.String type)
          Clear items from the cache.
 boolean clearCache(java.lang.String type, java.lang.String scope)
          Clear items from the cache.
 boolean clearCache(java.lang.String type, java.lang.String scope, int id)
          Clear items from the cache.
 java.lang.String getCurrentScope()
          Get current scope or 0 if none set.
 java.lang.String getCurrentType()
          Get current type or 0 if none set.
static java.lang.Class getInterfaceClass()
           
static java.lang.String getInterfaceName()
           
static int getInterfaceVersion()
           
 java.lang.String getName()
          Return the name of the interface
 int getVersion()
          Return the version of the interface
static void initSCF()
           
protected  boolean isNativePointerValidSafe(long pointer)
           
 iDataBuffer readCache(java.lang.String type, java.lang.String scope, int id)
          Retrieve some data from the cache.
 void setCurrentScope(java.lang.String scope)
          Set current scope.
 void setCurrentType(java.lang.String type)
          Set current type.
 
Methods inherited from class crystalspace.jbind.impl.csutil.scf.csBase
decRef, equals, finalize, getRefCount, incRef, nDelete, queryInterface, queryInterfaceSafe
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getRefCount, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Constructor Detail

csCacheManager

public csCacheManager(iPointer nPointer)
Parameters:
nPointer -
Method Detail

getVersion

public int getVersion()
Description copied from interface: iBase
Return the version of the interface

Specified by:
getVersion in interface iBase
Specified by:
getVersion in class csBase

getName

public java.lang.String getName()
Description copied from interface: iBase
Return the name of the interface

Specified by:
getName in interface iBase
Specified by:
getName in class csBase

initSCF

public static void initSCF()

getInterfaceVersion

public static int getInterfaceVersion()

getInterfaceName

public static java.lang.String getInterfaceName()

getInterfaceClass

public static java.lang.Class getInterfaceClass()

isNativePointerValidSafe

protected boolean isNativePointerValidSafe(long pointer)
Specified by:
isNativePointerValidSafe in class csNativeObject
See Also:
csNativeObject.isNativePointerValidSafe(long)

cacheData

public boolean cacheData(iPointer data,
                         int size,
                         java.lang.String type,
                         java.lang.String scope,
                         int id)
Description copied from interface: iCacheManager
Cache some data. Returns true if this succeeded. Implemented in csNullCacheManager, and csVfsCacheManager.

Specified by:
cacheData in interface iCacheManager
Parameters:
data -
size -
type -
scope -
id -
Returns:
See Also:
iCacheManager.cacheData(crystalspace.jbind.interfaces.iPointer, int, java.lang.String, java.lang.String, int)

clearCache

public boolean clearCache()
Description copied from interface: iCacheManager
Clear items from the cache. There are four ways to call this function: * 0, 0, 0: clear entire cache. * 'type', 0, 0: clear everything of this type. * 'type', 'scope', 0: clear everything of this type and scope. * 'type', 'scope', id: clear the specific item. Returns true if items were deleted. Returns false if item was not found or deletion is not possible. Implemented in csNullCacheManager, and csVfsCacheManager.

Specified by:
clearCache in interface iCacheManager
Returns:
See Also:
iCacheManager.clearCache()

clearCache

public boolean clearCache(java.lang.String type)
Description copied from interface: iCacheManager
Clear items from the cache. There are four ways to call this function: * 0, 0, 0: clear entire cache. * 'type', 0, 0: clear everything of this type. * 'type', 'scope', 0: clear everything of this type and scope. * 'type', 'scope', id: clear the specific item. Returns true if items were deleted. Returns false if item was not found or deletion is not possible. Implemented in csNullCacheManager, and csVfsCacheManager.

Specified by:
clearCache in interface iCacheManager
Parameters:
type -
Returns:
See Also:
iCacheManager.clearCache(java.lang.String)

clearCache

public boolean clearCache(java.lang.String type,
                          java.lang.String scope)
Description copied from interface: iCacheManager
Clear items from the cache. There are four ways to call this function: * 0, 0, 0: clear entire cache. * 'type', 0, 0: clear everything of this type. * 'type', 'scope', 0: clear everything of this type and scope. * 'type', 'scope', id: clear the specific item. Returns true if items were deleted. Returns false if item was not found or deletion is not possible. Implemented in csNullCacheManager, and csVfsCacheManager.

Specified by:
clearCache in interface iCacheManager
Parameters:
type -
scope -
Returns:
See Also:
iCacheManager.clearCache(java.lang.String, java.lang.String)

clearCache

public boolean clearCache(java.lang.String type,
                          java.lang.String scope,
                          int id)
Description copied from interface: iCacheManager
Clear items from the cache. There are four ways to call this function: * 0, 0, 0: clear entire cache. * 'type', 0, 0: clear everything of this type. * 'type', 'scope', 0: clear everything of this type and scope. * 'type', 'scope', id: clear the specific item. Returns true if items were deleted. Returns false if item was not found or deletion is not possible. Implemented in csNullCacheManager, and csVfsCacheManager.

Specified by:
clearCache in interface iCacheManager
Parameters:
type -
scope -
id -
Returns:
See Also:
iCacheManager.clearCache(java.lang.String, java.lang.String, int)

getCurrentScope

public java.lang.String getCurrentScope()
Description copied from interface: iCacheManager
Get current scope or 0 if none set. Implemented in csNullCacheManager, and csVfsCacheManager.

Specified by:
getCurrentScope in interface iCacheManager
Returns:
See Also:
iCacheManager.getCurrentScope()

getCurrentType

public java.lang.String getCurrentType()
Description copied from interface: iCacheManager
Get current type or 0 if none set. Implemented in csNullCacheManager, and csVfsCacheManager.

Specified by:
getCurrentType in interface iCacheManager
Returns:
See Also:
iCacheManager.getCurrentType()

readCache

public iDataBuffer readCache(java.lang.String type,
                             java.lang.String scope,
                             int id)
Description copied from interface: iCacheManager
Retrieve some data from the cache. Returns 0 if the data could not be found in the cache. Remarks: Returned buffer is NOT null-terminated. Don't modify returned buffer! Implemented in csNullCacheManager, and csVfsCacheManager.

Specified by:
readCache in interface iCacheManager
Parameters:
type -
scope -
id -
Returns:
See Also:
iCacheManager.readCache(java.lang.String, java.lang.String, int)

setCurrentScope

public void setCurrentScope(java.lang.String scope)
Description copied from interface: iCacheManager
Set current scope. This will be used in CacheData(); and ReadCache(); when the given 'scope' there is 0. Implemented in csNullCacheManager, and csVfsCacheManager.

Specified by:
setCurrentScope in interface iCacheManager
Parameters:
scope -
See Also:
iCacheManager.setCurrentScope(java.lang.String)

setCurrentType

public void setCurrentType(java.lang.String type)
Description copied from interface: iCacheManager
Set current type. This will be used in CacheData(); and ReadCache(); when the given 'type' there is 0. Implemented in csNullCacheManager, and csVfsCacheManager.

Specified by:
setCurrentType in interface iCacheManager
Parameters:
type -
See Also:
iCacheManager.setCurrentType(java.lang.String)