|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.funambol.storage.NamedObjectStore
public class NamedObjectStore
This class uses the J2ME RMS to store and retrieve objects using a name. The first record of the record store is used to save the index. A recordstore managed by NamedObjectStore must be modified using this class methods only, or the index will be currupted. To persist an object using ObjectStore, it must implement the com.funambol.storage.Serializable interface.
Constructor Summary | |
---|---|
NamedObjectStore()
Creates a new instance of ObjectStore. |
Method Summary | |
---|---|
void |
close()
Close the current RecordStore, if open. |
boolean |
create(java.lang.String name)
Creates a new RecordStore, or open an existing one. |
int |
getAvaliableStorage()
Returns the amount of additional room (in bytes) available for this record store to grow. |
Serializable |
getFirstObject(Serializable obj)
Retrieve the first serializable object from the record store. |
Serializable |
getNextObject(Serializable obj)
Retrieve the next serializable object from the record store. |
int |
lookup(java.lang.String name)
Search for a name in the record store, returning the object index |
java.lang.String[] |
names()
Retrieve the list of names from the record store. |
boolean |
open(java.lang.String name)
Open an existing RecordStore, or throws an exception if not present. |
boolean |
remove(java.lang.String name)
Remove the object from the store. |
Serializable |
retrieve(int index,
Serializable obj)
Retrieve the serializable object from the record store, using a positional index. |
Serializable |
retrieve(java.lang.String name,
Serializable obj)
Retrieve the serializable object from the record store, using name to index it. |
int |
size()
Returns the number of objects in the store. |
boolean |
store(java.lang.String name,
Serializable obj)
Store the serializable object in the ObjectStore, using the name hashcode to index it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NamedObjectStore()
Method Detail |
---|
public boolean open(java.lang.String name) throws javax.microedition.rms.RecordStoreException, java.io.IOException
name
- is the name of the RecordStore to be managed
javax.microedition.rms.RecordStoreException
java.io.IOException
public void close() throws javax.microedition.rms.RecordStoreException
javax.microedition.rms.RecordStoreException
- if the ObjectStore was not open.public boolean create(java.lang.String name) throws javax.microedition.rms.RecordStoreException, java.io.IOException
name
- is the name of the RecordStore to be managed
javax.microedition.rms.RecordStoreException
java.io.IOException
public boolean store(java.lang.String name, Serializable obj) throws javax.microedition.rms.RecordStoreException, java.io.IOException
name
- the name of the objectobj
- the serializable object
javax.microedition.rms.RecordStoreException
java.io.IOException
public Serializable retrieve(java.lang.String name, Serializable obj) throws javax.microedition.rms.RecordStoreException, java.io.IOException
name
- the name of the objectobj
- the serializable object
javax.microedition.rms.RecordStoreException
java.io.IOException
public Serializable retrieve(int index, Serializable obj) throws javax.microedition.rms.RecordStoreException, java.io.IOException
index
- the index in the recordstore.obj
- the serializable object
javax.microedition.rms.RecordStoreException
java.io.IOException
public java.lang.String[] names()
public int lookup(java.lang.String name)
name
- the name of the object
public Serializable getFirstObject(Serializable obj) throws javax.microedition.rms.RecordStoreException, java.io.IOException
obj
- the serializable object
javax.microedition.rms.RecordStoreException
java.io.IOException
public Serializable getNextObject(Serializable obj) throws javax.microedition.rms.RecordStoreException, java.io.IOException
obj
- the serializable object
javax.microedition.rms.RecordStoreException
java.io.IOException
public boolean remove(java.lang.String name) throws javax.microedition.rms.RecordStoreException, java.io.IOException
name
- the serializable object name
javax.microedition.rms.RecordStoreException
java.io.IOException
public int size()
public int getAvaliableStorage()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |