gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:56:15 25 4
gpt4 key购买 nike

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

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com