public class SDSCache<V extends SimpleDataStructure>
extends java.lang.Object
private static final SDSCache<Foo> _cache = new SDSCache(Foo.class, LENGTH, 1024); public static Foo create(byte[] data) { return _cache.get(data); } public static Foo create(byte[] data, int off) { return _cache.get(data, off); } public static Foo create(InputStream in) throws IOException { return _cache.get(in); }
修飾子とタイプ | メソッド | 説明 |
---|---|---|
void |
clear() |
|
V |
get(byte[] data) |
WARNING - If the SDS is found in the cache, the passed-in
byte array will be returned to the SimpleByteCache for reuse.
|
V |
get(byte[] b,
int off) |
|
V |
get(java.io.InputStream in) |
public SDSCache(java.lang.Class<V> rvClass, int len, int max)
rvClass
- the class that we are storing, i.e. an extension of SimpleDataStructurelen
- the length of the byte array in the SimpleDataStructuremax
- maximum size of the cache assuming 128MB of mem.
The actual max size will be scaled based on available memory.public void clear()
public V get(byte[] data)
data
- non-null, the byte array for the SimpleDataStructurejava.lang.IllegalArgumentException
- if data is not the correct number of bytesjava.lang.NullPointerException
public V get(byte[] b, int off)
public V get(java.io.InputStream in) throws java.io.IOException
java.io.IOException