J2ME RMS

12,073 views

Published on

J2ME RMS

1 Comment
5 Likes
Statistics
Notes
No Downloads
Views
Total views
12,073
On SlideShare
0
From Embeds
0
Number of Embeds
140
Actions
Shares
0
Downloads
21
Comments
1
Likes
5
Embeds 0
No embeds

No notes for slide

J2ME RMS

  1. 1. J2ME – Record management system Rohan Chandane rohan.chandane@indiatimes.com This notes are created by me, Rohan Chandane as learning material while pursuing MSc (CA) from SICSR. (CC) 2005-07
  2. 2. Basics  Record Management System (RMS)  Provides a mechanism  MIDlets can  Persistently store data  Retrieve it later even if device switched off  It stores data in binary format in mobile device
  3. 3. Overview of J2ME RMS and MIDlet interfacing
  4. 4. Records and Record Store  Storage Mechanism termed as  Record Store  Record Store consist  Records – Individual units of storage  Record  Is an array of bytes  Stored in binary file
  5. 5. Package  Package used  javax.microedition.rms  For Record stored class used  javax.microedition.rms.RecordStore  Provides several methods to manage records in Record Store  Insert  Update  Delete
  6. 6. RecordStore Class  Methods in RecordStore  openRecordStore()  Open Record Store  closeRecordStore()  Close Record Store  deleteRecordStore()  Delete Record Store  enumerateRecords()  Used to obtain enumeration object, which represents entire set of records in Record Store
  7. 7. Continued…  getName()  Used to obtain name of Record Store  getRecord()  Retrieve a record from Record set  getNumRecord()  Obtain a number of records in Record Store  addRecord()  Add record to Record Store  deleteRecord()  Delete record from Record Store
  8. 8. Continued…  Interfaces in RMS package  RecordEnumeration  Provide navigation in both direction through record store  It has following methods defined  nextRecordId() – returns Id of next record  nextRecord() – returns next record  previousRecordId() – returns Id of previous record  previousRecord() – returns previous record  hasNextElement() – true, if there is next record  hasPreviousElement() – true, if there is previous record
  9. 9. Continued…  RecordComparator  Provide comparison between two records in a record store  RecordFilter  Provide a mechanism to check if a record matches a specific criterion  RecordListener  Provide an event listener that is notified when event is added, deleted or modified
  10. 10. Managing record stores  Open a RecordStore RecordStore rs = RecordStore.openRecordStore(quot;MyAppointmentsquot;,true);  Close a RecordStore Rs.closeRecordStore();  Delete a RecordStore RecordStore.deleteRecordStore(quot;MyAppointmentsquot;);
  11. 11. Continued…  Insert a record String appt = quot;new recordquot;; byte bytes[] = appt.getBytes(); rs.addRecord(bytes,0,bytes.length);  Updating records String newappt = quot;update recordquot;; Byte data = newappt.getBytes(); Rs.setRecord(1, data, 0, data.length());
  12. 12. Continued…  Deleting records Rs.deleteRecord(1);

×