数据RMS可以存储多少?

时间:2012-12-25 13:01:44

标签: java-me midp rms recordstore

我想使用RMS存储大量数据。我检查了一定的限制。我只是想确保能够存储它的RMS吗?

我在RMS中存储了大约1,35,000个字符,我也可以从RMS中获取它们。我可以使用RMS存储多少数据?

我想在Live Application中实现它。

1 个答案:

答案 0 :(得分:4)

RMS存储容量没有这样的固定限制。这一切都取决于设备上可用的可用内存量。

在您的应用程序中尝试以下代码段以查找设备上的内存状态。

Runtime rt = Runtime.getRuntime();
long totalMemory = rt.totalMemory();
long freeMemory = rt.freeMemory();

// if rs is an instance of your App's RMS
// then, try
RecordStore rs = RecordStore.openRecordStore( "App_Db_Name_Here", true );
int sizeAvailable = rs.getSizeAvailable();
// it returns the amount of additional room (in bytes) available
// for this record store to grow.

比较上述三个值并在您的申请中进行相应的处理。

但随着大小的增加,RMS IO操作会变慢,因此这种本地数据库不会用于存储大数据。同样,这因设备而异。您应该在跨设备上移植应用程序时决定实施。

请参阅 RecordStore getSizeAvailable() < / strong>完整备注的文档。