J2ME learning notes (10)

xiaoxiao2021-03-06  39

What kind of RMS? Record Management System. In fact, a database management system defined by MIDP. You can save the status of objects or objects. Similar to all databases, the RMS can also define a lot of different tables, which are called Record Stroe in RMS. All classes related to RMS are stored in the javax.microedition.rms package. It mainly includes three interfaces with the RecordStore, Recordenumeration class, and RecordComparator, Recordfilter, RecordListener. In each MIDlet Suite, each database has its unique name, and its uppercase cannot exceed 32 Unicode characters, which are case sensitive. Method RecordStore.OpenRecordStore (RMS name, true / false) is used to open a record library. If the incoming parameter is true, you will create a new Record when the program can't find this RECORD; if you pass false, the system will throw RecordStroenotFoundException when you can't find this RECORD. After opening a record library, several methods are defined in the RecordStore class to achieve relevant information: 1, getLastModified () gets the last modification time 2, getName () get the record library name 3, getNextRecordId () get the next record ID 4, GetnumRecords () acquires the number of records in the record library 5, getSize () gets the system space occupied by the current record library 6, getSizeavailable () how many spaces can be used in the current system available 7, getVersion () acquire the record library version number. Every time you change the log library data version number will be updated. 8. ListRecordStores () gets all the record libraries in the current MIDlet Suite 9, CloseRecordStore () Close the log library (actually telling the THAM of the current record library no longer use the record library) 9, deleteRecordStore () Delete the log library RecordStore provides 5 access to the method: 1. Int addRecord (byte [] data, int offset, int Numbytes put the Bytes array to the database while returning to the corresponding third. For the record library, the RecordID is equivalent to the primary key. 2, int GETRECORD (int RecordID, Byte [] Data, int offset Removes the record corresponding to RecordID. 3, byte [] getRecord (int Recordid) Remove the corresponding record 4, void setRecord (int recordid, byte [] newdata, int offset, int num bittes update the corresponding record 5, Void deleteRecord (int Recordid) delete corresponding record

Record management provides a RecordListener interface that listens to the new, change, delete of records recorded in the log library. At the same time, it supports multicase, that is, it allows many people to listen simultaneously at the same time.

转载请注明原文地址:https://www.9cbs.com/read-67714.html

New Post(0)