📄 systeminfo.java~16~
字号:
package org.zblog.zenghelper.dbtool;
import java.io.DataInputStream;
import java.io.ByteArrayInputStream;
import javax.microedition.rms.RecordEnumeration;
import javax.microedition.rms.RecordStore;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
/**
* <p>Title: ZEngHelper</p>
*
* <p>Description: Z英汉词典</p>
*
* <p>Copyright: Zcw Copyright (c) 2004</p>
*
* <p>Company: www.zblog.org Z动力</p>
*
* @author 朱传伟-ZCW
* @version 1.0
*/
public class SystemInfo {
private DbTool dt=DbTool.getInstance();
public boolean isEnToCn=true;
public boolean isRandom=true;
/**
* 从数据库初始化SystemInfo类
*/
public void dbInit(){
try{
RecordStore rs=dt.openRS(DbTool.SYSTEM_DB);
RecordEnumeration re=rs.enumerateRecords(null,null,false);
if(re.hasNextElement()){
byte[]bs=re.nextRecord();
ByteArrayInputStream bis = new ByteArrayInputStream(bs);
DataInputStream dis = new DataInputStream(bis);
isEnToCn=dis.readBoolean();
isRandom=dis.readBoolean();
dis.close();
bis.close();
}
rs.closeRecordStore();
}
catch(Exception e){
e.printStackTrace();
}
}
/**
* 保存修改后的系统属性
*/
public void store(){
try{
ByteArrayOutputStream bos=new ByteArrayOutputStream();
DataOutputStream dos=new DataOutputStream(bos);
dos.writeBoolean(isEnToCn);
dos.writeBoolean(isRandom);
byte[]bytes=bos.toByteArray();
dos.close();
bos.close();
RecordStore rs=dt.openRS(DbTool.SYSTEM_DB);
RecordEnumeration re=rs.enumerateRecords(null,null,false);
if(re.hasNextElement()){
int id=re.nextRecordId();
rs.setRecord(id,bytes,0,bytes.length);
}
else{
rs.addRecord(bytes,0,bytes.length);
}
rs.closeRecordStore();
}
catch(Exception e){
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -