Fields Summary |
---|
static final int | RS0_SIGNATURERS_SIGNATURE offset |
static final int | RS1_AUTHMODERS_AUTHMODE offset |
static final int | RS2_NEXT_IDRS_NEXT_ID offset |
static final int | RS3_NUM_LIVERS_NUM_LIVE offset |
static final int | RS4_VERSIONRS_VERSION offset |
static final int | RS5_LAST_MODIFIEDRS_LAST_MODIFIED offset |
static final int | RS6_DATA_SIZERS_START_OF_DATA offset |
static final int | RS7_FREE_SIZERS_START_OF_DATA offset |
static final int | DB_HEADER_SIZESize of the db header |
static final byte[] | DB_SIGNATUREpre initialized RecordStore header structure |
static final int | COMPACT_BUFFER_SIZEused to compact the records of the record store |
static final int | BLOCK_HEADER_SIZESize of the block header |
static final int | AUTHMODE_ANY_ROInternal indicator for AUTHMODE_ANY with read only access
AUTHMODE_ANY_RO has a value of 2. |
Methods Summary |
---|
public int | addRecord(byte[] data, int offset, int numBytes)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.
|
public void | closeRecordStore()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.
|
public AbstractRecordStoreFile | createIndexFile(int suiteId, java.lang.String name)Creates data base index file associated with this record store
|
public void | deleteRecord(int recordId)The record is deleted from the record store. The recordId for
this record is NOT reused.
|
public int | getAuthMode()Get the authorization mode for this record store.
|
public AbstractRecordStoreFile | getDbFile()Returns data base file associated with this record store
|
public long | getLastModified()Returns the last time the record store was modified, in the
format used by System.currentTimeMillis().
|
public int | getNextRecordID()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() .
|
public int | getNumRecords()Returns the number of records currently in the record store.
|
public int | getRecord(int recordId, byte[] buffer, int offset)Returns the data stored in the given record.
|
public byte[] | getRecord(int recordId)Returns a copy of the data stored in the given record.
|
public int[] | getRecordIDs()Returns all of the recordId's currently in the record store.
|
public int | getRecordSize(int recordId)Returns the size (in bytes) of the MIDlet data available
in the given record.
|
public int | getSize()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.
|
public int | getSizeAvailable()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.
|
public int | getVersion()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.
|
public void | setMode(int authmode, boolean writable)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.
|
public void | setRecord(int recordId, byte[] newData, int offset, int numBytes)Sets the data in the given record to that passed in. After
this method returns, a call to getRecord(int recordId)
will return an array of numBytes size containing the data
supplied here.
|