⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 record.java

📁 这是一个用j2me编写的手机管理系统。主要功能为课程表
💻 JAVA
字号:
package coursesManager;

import javax.microedition.rms.*;

public class Record {
	
	private RecordStore rs;
	private String rsName;
	
	public Record(String recordName){
		rsName=recordName;
		try{
			rs=RecordStore.openRecordStore(rsName, true,RecordStore.AUTHMODE_ANY,true);
		}
		catch(Exception e){
			System.out.println("Record Error:"+e);
		}
	}
	
	public void close(){
		try{
			rs.closeRecordStore();
		}
		catch(Exception e){
			System.out.println(e);
		}
	}
	
	public boolean empty(){
		try{
			if(rs.getNumRecords()>0){
				return false;
			}
			else{
				return true;
			}
		}
		catch(Exception e){
			System.out.println(e);
		}
		return true;
	}
	
	public void setRecord(byte[] buffer){
		try{
			if(empty()){
				rs.addRecord(buffer, 0, buffer.length);
			}
			else{
				rs.setRecord(1, buffer, 0, buffer.length);
			}
		}
		catch(Exception e){
			System.out.println(e);
		}
	}
	
	public byte[] getRecord(){
		byte buffer[];
		try{
			buffer=rs.getRecord(1);
			return buffer;
		}
		catch(Exception e){
			System.out.println(e);
		}
		return null;
	}
	
	public void deleteRecord(){
		try{
			rs.deleteRecordStore(rsName);
		}
		catch(Exception e){
			System.out.println(e);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -