| com.sun.midp.rms.AbstractRecordStoreImpl
All known Subclasses: com.sun.midp.rms.RecordStoreImpl,
AbstractRecordStoreImpl | interface AbstractRecordStoreImpl (Code) | | An interface for a record store implementation.
|
Method Summary | |
int | addRecord(byte[] data, int offset, int numBytes) Adds a new record to the record store. | void | closeRecordStore() This method is called when the MIDlet requests to have the
record store closed. | AbstractRecordStoreFile | createIndexFile(int suiteId, String name) | void | deleteRecord(int recordId) The record is deleted from the record store. | int | getAuthMode() Get the authorization mode for this record store. | AbstractRecordStoreFile | getDbFile() | long | getLastModified() Returns the last time the record store was modified, in the
format used by System.currentTimeMillis(). | int | getNextRecordID() Returns the recordId of the next record to be added to the
record store. | int | getNumRecords() Returns the number of records currently in the record store. | int | getRecord(int recordId, byte[] buffer, int offset) Returns the data stored in the given record. | byte[] | getRecord(int recordId) Returns a copy of the data stored in the given record.
Parameters: recordId - the ID of the record to use in this operation exception: RecordStoreNotOpenException - if the record store isnot open exception: InvalidRecordIDException - if the recordId is invalid exception: RecordStoreException - if a general record storeexception occurs the data stored in the given record. | int[] | getRecordIDs() Returns all of the recordId's currently in the record store. | int | getRecordSize(int recordId) Returns the size (in bytes) of the MIDlet data available
in the given record. | int | getSize() Returns the amount of space, in bytes, that the record store
occupies. | int | getSizeAvailable() Returns the amount of additional room (in bytes) available for
this record store to grow. | int | getVersion() Each time a record store is modified (by
addRecord , setRecord , or
deleteRecord methods) its version is
incremented. | void | setMode(int authmode, boolean writable) Changes the access mode for this RecordStore. | void | setRecord(int recordId, byte[] newData, int offset, int numBytes) Sets the data in the given record to that passed in. |
AUTHMODE_ANY_RO | final static int AUTHMODE_ANY_RO(Code) | | Internal indicator for AUTHMODE_ANY with read only access
AUTHMODE_ANY_RO has a value of 2.
|
BLOCK_HEADER_SIZE | final static int BLOCK_HEADER_SIZE(Code) | | Size of the block header
|
COMPACT_BUFFER_SIZE | final static int COMPACT_BUFFER_SIZE(Code) | | used to compact the records of the record store
|
DB_HEADER_SIZE | final static int DB_HEADER_SIZE(Code) | | Size of the db header
|
DB_SIGNATURE | final static byte[] DB_SIGNATURE(Code) | | pre initialized RecordStore header structure
|
RS0_SIGNATURE | final static int RS0_SIGNATURE(Code) | | RS_SIGNATURE offset
|
RS1_AUTHMODE | final static int RS1_AUTHMODE(Code) | | RS_AUTHMODE offset
|
RS2_NEXT_ID | final static int RS2_NEXT_ID(Code) | | RS_NEXT_ID offset
|
RS3_NUM_LIVE | final static int RS3_NUM_LIVE(Code) | | RS_NUM_LIVE offset
|
RS4_VERSION | final static int RS4_VERSION(Code) | | RS_VERSION offset
|
RS5_LAST_MODIFIED | final static int RS5_LAST_MODIFIED(Code) | | RS_LAST_MODIFIED offset
|
RS6_DATA_SIZE | final static int RS6_DATA_SIZE(Code) | | RS_START_OF_DATA offset
|
RS7_FREE_SIZE | final static int RS7_FREE_SIZE(Code) | | RS_START_OF_DATA offset
|
addRecord | int addRecord(byte[] data, int offset, int numBytes) throws RecordStoreNotOpenException, RecordStoreException, RecordStoreFullException(Code) | | Adds a new record to the record store. The recordId for this
new record is returned. This is a blocking atomic operation.
The record is written to persistent storage before the
method returns.
Parameters: data - the data to be stored in this record. If the recordis to have zero-length data (no data), this parameter may benull. Parameters: offset - the index into the data buffer of the firstrelevant byte for this record Parameters: numBytes - the number of bytes of the data buffer to usefor this record (may be zero) the recordId for the new record exception: RecordStoreNotOpenException - if the record store isnot open exception: RecordStoreException - if a different recordstore-related exception occurred exception: RecordStoreFullException - if the operation cannot becompleted because the record store has no more room exception: SecurityException - if the MIDlet has read-only accessto the RecordStore |
closeRecordStore | void closeRecordStore() throws RecordStoreNotOpenException, RecordStoreException(Code) | | This method is called when the MIDlet requests to have the
record store closed. Note that the record store will not
actually be closed until closeRecordStore() is called as many
times as openRecordStore() was called. In other words, the
MIDlet needs to make a balanced number of close calls as open
calls before the record store is closed.
When the record store is closed, all listeners are removed
and all RecordEnumerations associated with it become invalid.
If the MIDlet attempts to perform
operations on the RecordStore object after it has been closed,
the methods will throw a RecordStoreNotOpenException.
exception: RecordStoreNotOpenException - if the record store isnot open exception: RecordStoreException - if a different recordstore-related exception occurred |
getAuthMode | int getAuthMode()(Code) | | Get the authorization mode for this record store.
authorization mode |
getLastModified | long getLastModified()(Code) | | Returns the last time the record store was modified, in the
format used by System.currentTimeMillis().
the last time the record store was modified, in theformat used by System.currentTimeMillis() |
getNextRecordID | int getNextRecordID()(Code) | | Returns the recordId of the next record to be added to the
record store. This can be useful for setting up pseudo-relational
relationships. That is, if you have two or more
record stores whose records need to refer to one another, you can
predetermine the recordIds of the records that will be created
in one record store, before populating the fields and allocating
the record in another record store. Note that the recordId returned
is only valid while the record store remains open and until a call
to addRecord() .
the recordId of the next record to be added to therecord store |
getNumRecords | int getNumRecords()(Code) | | Returns the number of records currently in the record store.
the number of records currently in the record store |
getRecordIDs | int[] getRecordIDs()(Code) | | Returns all of the recordId's currently in the record store.
an array of the recordId's currently in the record storeor null if the record store is closed. |
getSize | int getSize()(Code) | | Returns the amount of space, in bytes, that the record store
occupies. The size returned includes any overhead associated
with the implementation, such as the data structures
used to hold the state of the record store, etc.
the size of the record store in bytes |
getSizeAvailable | int getSizeAvailable()(Code) | | Returns the amount of additional room (in bytes) available for
this record store to grow. Note that this is not necessarily
the amount of extra MIDlet-level data which can be stored,
as implementations may store additional data structures with
each record to support integration with native applications,
synchronization, etc.
the amount of additional room (in bytes) available forthis record store to grow |
getVersion | int getVersion() throws RecordStoreNotOpenException(Code) | | Each time a record store is modified (by
addRecord , setRecord , or
deleteRecord methods) its version is
incremented. This can be used by MIDlets to quickly tell if
anything has been modified.
The initial version number is implementation dependent.
The increment is a positive integer greater than 0.
The version number increases only when the RecordStore is updated.
The increment value need not be constant and may vary with each
update.
the current record store version |
setMode | void setMode(int authmode, boolean writable) throws RecordStoreException(Code) | | Changes the access mode for this RecordStore. The authorization
mode choices are:
AUTHMODE_PRIVATE - Only allows the MIDlet
suite that created the RecordStore to access it. This
case behaves identically to
openRecordStore(recordStoreName,
createIfNecessary) .
AUTHMODE_ANY - Allows any MIDlet to access the
RecordStore. Note that this makes your recordStore
accessible by any other MIDlet on the device. This
could have privacy and security issues depending on
the data being shared. Please use carefully.
The owning MIDlet suite may always access the RecordStore and
always has access to write and update the store. Only the
owning MIDlet suite can change the mode of a RecordStore.
Parameters: authmode - the mode under which to check or create access.Must be one of AUTHMODE_PRIVATE or AUTHMODE_ANY. Parameters: writable - true if the RecordStore is to be writable byother MIDlet suites that are granted access exception: RecordStoreException - if a record store-relatedexception occurred exception: SecurityException - if this MIDlet Suite is notallowed to change the mode of the RecordStore exception: IllegalArgumentException - if authmode is invalid |
|
|