java - Java Microedition RMS 是否在打开时标记为已修改但未进行数据更改?

标签 java mobile java-me rms

我想知道打开 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, or deleteRecord 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/

相关文章:

java - lwuit向导并部署

java - Android 中可离线使用的文本转语音

java - 如何在圆形范围内的android map 上生成标记

Java vertx 3.2 使用bodyhandler上传文件

java - 在手机中调用 System.gc()

java - 如何提高我的应用程序的速度?

java - jsp中迭代ArrayList时出现NullPointerException

mobile - 使 Adsense 响应式

css - 有没有人有适用于大多数手机/设备的移动 CSS 模板的良好资源?

javascript - 布局 Dojo 移动应用程序