RMS读取 public static byte[] read_Set(int ctr) { byte[] tb = null; RecordStore rs = null; try { rs = RecordStore.openRecordStore(rmsName, true); Log.logOut("read_Set:" + rs.getNumRecords()); if (ctr == 0) tb = rs.getRecord(1); else tb = rs.getRecord(2); } catch (Exception ex) { ex.printStackTrace(); try { RecordStore.deleteRecordStore(rmsName); } catch (RecordStoreException ex2) { } } finally { try { rs.closeRecordStore(); } catch (RecordStoreException ex1) { } rs = null; } return tb; } RMS保存 public static void save_Set(byte[] nbyte, int ctr) { RecordStore rs = null; try { rs = RecordStore.openRecordStore(rmsName, true); int leng = rs.getNumRecords(); if (leng == 0) rs.addRecord(nbyte, 0, nbyte.length); else { if (ctr == 0) rs.setRecord(1, nbyte, 0, nbyte.length); else { if (leng == 1) { rs.addRecord(nbyte, 0, nbyte.length); } else { rs.setRecord(2, nbyte, 0, nbyte.length); } } } } catch (Exception ex) { ex.printStackTrace(); try { RecordStore.deleteRecordStore(rmsName); } catch (RecordStoreException ex2) { } } finally { try { rs.closeRecordStore(); } catch (RecordStoreException ex1) { } } }