📄 baserms.java
字号:
package cn.com.javachen;
import javax.microedition.rms.RecordStore;
abstract public class BaseRMS {
private String rmsName;
private RecordStore recordStore;
BaseRMS(String rmsName) {
this.rmsName = rmsName;
}
public void open() throws Exception {
try {
recordStore = RecordStore.openRecordStore(this.rmsName,true);
if (recordStore.getNumRecords() > 0) {
loadData();
} else {
createDefaultData();
}
} catch (Exception e) {
throw new Exception(this.rmsName+"::open::"+e);
}
}
public void close() throws Exception {
if (recordStore != null) {
try {
recordStore.closeRecordStore();
} catch(Exception e) {
throw new Exception(this.rmsName+"::close::"+e);
}
}
}
public RecordStore getRecordStore() {
return this.recordStore;
}
public String getRMSName() {
return this.rmsName;
}
abstract void loadData() throws Exception;
abstract void createDefaultData() throws Exception;
abstract void updateData() throws Exception;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -