codesimian
Class Cache

java.lang.Object
  extended by codesimian.Cache

public class Cache
extends java.lang.Object

Uses a (weak or normal?) WeakHashMap to store large files as byte[] arrays (or other type of array), like an mp3 from the internet or your hard-drive. If the same file was loaded multiple times, that would waste memory.

To save memory, does not copy the array to a new array. Uses the same array, so it could be modified. Be careful.


Constructor Summary
Cache()
           
 
Method Summary
static void add(java.lang.String fileNameOrURL, java.lang.Object data)
           
static java.lang.Object get(java.lang.String fileNameOrURL)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache()
Method Detail

get

public static java.lang.Object get(java.lang.String fileNameOrURL)

add

public static void add(java.lang.String fileNameOrURL,
                       java.lang.Object data)