我想知道打开 RMS 记录是否检查它是否在 javame 中被修改。 例如
RecordStore rs;
//First RMS access
rs.open("gamescores",true);
rs.addRecord(null,0,0);
rs.closeRecordStore;
//Second RMS access
rs = RecordStore.open("gamescores",true);
long timeStamp = rs.getLastModified();
rs.closeRecordStore();
getLastModified() 会返回第一次或第二次 RMS 访问的时间。
最佳答案
一种不同的方法旨在跟踪记录的修改 - getVersion() :
Each time a record store is modified (by
addRecord
,setRecord
, ordeleteRecord
methods) its version is incremented. This can be used by MIDlets to quickly tell if anything has been modified. The initial version number is implementation dependent. The increment is a positive integer greater than 0. The version number increases only when the RecordStore is updated. The increment value need not be constant and may vary with each update.
至于getLastModified方法,其规范不允许以可移植的方式可靠地告诉您所询问的差异:
Returns the last time the record store was modified, in the format used by System.currentTimeMillis().
关于java - Java Microedition RMS 是否在打开时标记为已修改但未进行数据更改?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12084245/