use of javax.microedition.rms.RecordStoreNotOpenException in project J2ME-Loader by nikita36078.
the class RecordStoreImpl method getSize.
@Override
public int getSize() throws RecordStoreNotOpenException {
if (!open) {
throw new RecordStoreNotOpenException();
}
// TODO include size overhead such as the data structures used to hold the state of the record store
// Preload all records
enumerateRecords(null, null, false);
int result = 0;
Enumeration keys = records.keys();
while (keys.hasMoreElements()) {
int key = ((Integer) keys.nextElement()).intValue();
try {
byte[] data = getRecord(key);
if (data != null) {
result += data.length;
}
} catch (RecordStoreException e) {
e.printStackTrace();
}
}
return result;
}
Aggregations