J2ME有关RMS知识.ppt

J2ME有关RMS知识

王魁祎 wangjinhui541@126.com RecordStore记录操作 如下代码: 系统打印的结果为: 记录1占据空间为:6 记录2占据空间为:5 RecordStore rs1 = RecordStore.openRecordStore(RS1, true); String str1 = 中国人; byte[] b1 = str1.getBytes(); rs.addRecord(b1, 0, b1.length); String str2 = China; byte[] b2 = str2.getBytes(); rs.addRecord(b2, 0, b2.length); System.out.println(记录1占据空间为:+ rs1.getRecordSize(1)); System.out.println(记录2占据空间为:+ rs1.getRecordSize(2)); RMS对象存储 前面章节中都提到了将数据保存在RecordStore中,但是保存的是简单数据。在某些特定场合,需要保存在RecordStore中的可能不是简单数据。如将用户的通讯记录保存在RecordStore中时,就必须同时保存姓名和电话号码两个字段,这就牵涉到怎样将对象保存在RMS中的技术。比如,有一个Student类,里面包

文档评论(0)

1亿VIP精品文档

相关文档