Blackberry JAVA DEVELOPMENT ENVIRONMENT - - CRYPTOGRAPHIC SMART CARD DRIVER - DEVELOPMENT GUIDE Guía para resolver problemas Pagina 75

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 286
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 74
75
3: Storing data
Use the MIDP record store
Task Steps
Create a record store. >Invoke openRecordStore() and specify true to indicate that the method should create the record store
if the record store does not exist.
RecordStore store = RecordStore.openRecordStore("Contacts", true);
Add a record. >Invoke addRecord().
int id = store.addRecord(_data.getBytes(), 0, _data.length());
Retrieve a record. >Invoke getRecord(int, byte[], int) and provide the following parameters:
a record ID
a byte array
an offset
byte[] data = new byte[store.getRecordSize(id)];
store.getRecord(id, data, 0);
String dataString = new String(data);
Retrieve all records. 1. Invoke openRecordStore().
RecordStore store = RecordStore.openRecordStore("Contacts", false);
2. Invoke enumerateRecords() with the following parameters:
filter: specifies a RecordFilter object to retrieve a subset of record store records (if null, the
method returns all records)
comparator: specifies a RecordComparator object to determine the order in which the method
returns the records (if null, the method returns the records in any order)
keepUpdated: determines if the method keeps the enumeration current with the changes to the
record store
RecordEnumeration e = store.enumerateRecords(null, null, false);
Vista de pagina 74
1 2 ... 70 71 72 73 74 75 76 77 78 79 80 ... 285 286

Comentarios a estos manuales

Sin comentarios