Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
RMSope.java
Package: Communication.rar [view]
Upload User: anders
Upload Date: 2022-07-15
Package Size: 376k
Code Size: 2k
Category:
J2ME
Development Platform:
Java
- package phoneLeter;
- import java.util.Vector;
- import javax.microedition.rms.RecordEnumeration;
- import javax.microedition.rms.RecordStore;
- public class RMSope {
- private String storeName;
- private RecordStore rs;
- //得到记录集的名称
- public RMSope(String storeName)
- {
- this.storeName=storeName;
- }
- //打开记录集
- public void openRecordStore()
- {
- try
- {
- rs=RecordStore.openRecordStore(storeName,true);
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- }
- }
- //增加记录集
- public void addPhone(String name,String phone)
- {
- String info=name+":"+phone;
- byte[] b=info.getBytes();
- try
- {
- rs.addRecord(b,0,b.length);
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- }
- //删除记录集
- public void deletePhone(String str)
- {
- int lastId=0;
- try
- {
- lastId=rs.getNextRecordID();
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- for(int i=1;i<lastId;i++)
- {
- try
- {
- byte[] b=rs.getRecord(i);
- String recordStr=new String(b);
- if(recordStr.equals(str))
- {
- rs.deleteRecord(i);
- }
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- }
- }
- //获取所有记录集
- public Vector getAllPhone()
- {
- Vector v=new Vector();
- try
- {
- RecordEnumeration re=rs.enumerateRecords(null, null, false);
- while(re.hasNextElement())
- {
- v.addElement(new String(re.nextRecord()));
- }
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- return v;
- }
- //关闭记录集
- public void closeRecordStore()
- {
- try
- {
- rs.closeRecordStore();
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- }
- }