com.beem.project.beem.smack.avatar
Class MemoryAvatarCache

Package class diagram package MemoryAvatarCache
java.lang.Object
  extended by com.beem.project.beem.smack.avatar.MemoryAvatarCache
All Implemented Interfaces:
AvatarCache

public class MemoryAvatarCache
extends Object
implements AvatarCache

An avatar cache which store the avatars in memory.


Constructor Summary
MemoryAvatarCache(int maxSize, long maxlifetime)
          Create a MemoryAvatarCache.
 
Method Summary
 boolean contains(String key)
          Test if a data is in cache.
 byte[] get(String key)
          Get some data from the cache.
 void put(String key, byte[] data)
          Put some datas in cache.
 void put(String key, InputStream in)
          Put some datas in cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryAvatarCache

public MemoryAvatarCache(int maxSize,
                         long maxlifetime)
Create a MemoryAvatarCache.

Parameters:
maxSize - the maximum number of objects the cache will hold. -1 means the cache has no max size.
maxlifetime - the maximum amount of time (in ms) objects can exist in cache before being deleted. -1 means objects never expire.
Method Detail

put

public void put(String key,
                byte[] data)
         throws IOException
Description copied from interface: AvatarCache
Put some datas in cache.

Specified by:
put in interface AvatarCache
Parameters:
key - the key id of the data
data - the data to cache
Throws:
IOException - if an IO error occurs while caching the data

put

public void put(String key,
                InputStream in)
         throws IOException
Description copied from interface: AvatarCache
Put some datas in cache.

Specified by:
put in interface AvatarCache
Parameters:
key - the key id of the data
in - an InputStream to the data to cache
Throws:
IOException - if an IO error occurs while caching the data

get

public byte[] get(String key)
           throws IOException
Description copied from interface: AvatarCache
Get some data from the cache.

Specified by:
get in interface AvatarCache
Parameters:
key - the id of the data to get
Returns:
the cached data
Throws:
IOException - if an IO error occurs while geting the data

contains

public boolean contains(String key)
Description copied from interface: AvatarCache
Test if a data is in cache.

Specified by:
contains in interface AvatarCache
Parameters:
key - the id of the data
Returns:
true if data is in cache false otherwise


Copyright © 2009 Beem-project.com. All Rights Reserved.