Line-by-line Anatomy of RecordStore
Project (Cont.)
byte[ ] raw = re.nextRecord( );
The method public byte[ ] javax.microedition.rms.RecordEnumeration.nextRecord returns a copy of the next record in this enumeration, where next is defined by the comparator and/or filter supplied in the constructor of this enumerator.
The byte array returned is a copy of the record.
Any changes made to this array will NOT be reflected in the record store.
After calling this method, the enumeration is advanced to the next available record.
re.destroy( );
The method public void javax.microedition.rms.RecordEnumeration.destroy frees internal resources used by this RecordEnumeration
.
MIDlets should call this method when they are done using a RecordEnumeration
.
If a MIDlet tries to use a RecordEnumeration
after this method has been called, it will throw a IllegalStateException
.
rs.closeRecordStore( );
The method public void javax.microedition.rms.RecordStore.closeRecordStore( ) 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.
- A
RecordStoreNotOpenException
is threw if MIDlet attempts to perform operations on the RecordStore
object after it has been closed.
int id = re.nextRecordId( );
The method public int javax.microedition.rms.RecordEnumeration.nextRecordId( ) returns the recordId
of the next record in this enumeration, where next
is defined by the comparator and/or filter supplied in the constructor of this enumerator.