本文整理汇总了Java中javax.microedition.rms.RecordEnumeration.nextRecordId方法的典型用法代码示例。如果您正苦于以下问题:Java RecordEnumeration.nextRecordId方法的具体用法?Java RecordEnumeration.nextRecordId怎么用?Java RecordEnumeration.nextRecordId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.rms.RecordEnumeration
的用法示例。
在下文中一共展示了RecordEnumeration.nextRecordId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTweets
import javax.microedition.rms.RecordEnumeration; //导入方法依赖的package包/类
public Tweet[] getTweets(TweetFilter filter) {
try {
RecordEnumeration enum = tweetStore.enumerateRecords(filter, new TweetComparator(), false);
Vector tweetList = new Vector();
while(enum.hasNextElement()) {
int id = enum.nextRecordId();
Tweet tw = new Tweet(tweetStore.getRecord(id));
tw.setStoreId(id);
tweetList.addElement(tw);
}
Tweet[] res = new Tweet[tweetList.size()];
tweetList.copyInto(res);
return res;
} catch (RecordStoreException e) {
e.printStackTrace();
return null;
}
}
示例2: getUsers
import javax.microedition.rms.RecordEnumeration; //导入方法依赖的package包/类
public User[] getUsers(UserFilter filter) {
try {
RecordEnumeration enum = userStore.enumerateRecords(filter, null, false);
Vector uList = new Vector();
while(enum.hasNextElement()) {
int id = enum.nextRecordId();
User u = new User(userStore.getRecord(id));
u.setStoreId(id);
uList.addElement(u);
}
User[] res = new User[uList.size()];
uList.copyInto(res);
return res;
} catch (RecordStoreException e) {
e.printStackTrace();
return null;
}
}
示例3: getAccounts
import javax.microedition.rms.RecordEnumeration; //导入方法依赖的package包/类
public Account[] getAccounts() {
try {
Vector accounts = new Vector();
RecordEnumeration enum = accountStore.enumerateRecords(null, null, false);
while(enum.hasNextElement()) {
int id = enum.nextRecordId();
Account acc = new Account(accountStore.getRecord(id));
acc.setStoreId(id);
accounts.addElement(acc);
}
Account[] arr = new Account[accounts.size()];
accounts.copyInto(arr);
return arr;
} catch (RecordStoreException e) {
e.printStackTrace();
return null;
}
}
示例4: testAddRecordDeleteRecord2
import javax.microedition.rms.RecordEnumeration; //导入方法依赖的package包/类
@Test
public void testAddRecordDeleteRecord2() throws RecordStoreException {
assertNull(RecordStore.listRecordStores());
String storeName = "testAddRecordDeleteRecord2";
RecordStore store = RecordStore.openRecordStore(storeName, true);
byte[] record = new byte[1024];
int firstCountAdd = -1;
for (int i=0; i < 4; i++) {
int countAdd = 0;
try {
while (true) {
fill(record, countAdd);
store.addRecord(record, 0, record.length);
countAdd++;
}
} catch (RecordStoreFullException e) {
}
assertTrue(countAdd > 0);
if (firstCountAdd == -1) {
firstCountAdd = countAdd;
} else {
assertEquals(firstCountAdd, countAdd);
}
RecordEnumeration records = store.enumerateRecords(null, null, false);
int countDelete = 0;
while (records.hasNextElement()) {
int recordId = records.nextRecordId();
byte[] bytes = store.getRecord(recordId);
assertEquals(bytes, bytes.length, countDelete);
store.deleteRecord(recordId);
countDelete++;
}
assertEquals(countDelete, countAdd);
}
store.closeRecordStore();
RecordStore.deleteRecordStore(storeName);
}
示例5: get
import javax.microedition.rms.RecordEnumeration; //导入方法依赖的package包/类
public String get(String key) {
if(rs == null) return null;
try {
RecordEnumeration re = rs.enumerateRecords(null, null, false);
while (re.hasNextElement()) {
int recordId = re.nextRecordId();
Setting setting = RecordStoreSetting.valueOf(recordId, rs.getRecord(recordId));
if(key.equals(setting.getKey())) return setting.getValue();
}
} catch (RecordStoreException e) {
Log.p("Error reading record store value for key [" + key + "] - " + e.getMessage(), Log.ERROR);
}
return null;
}
示例6: getId
import javax.microedition.rms.RecordEnumeration; //导入方法依赖的package包/类
private int getId(String key) {
try {
RecordEnumeration re = rs.enumerateRecords(null, null, false);
while (re.hasNextElement()) {
int recordId = re.nextRecordId();
Setting setting = RecordStoreSetting.valueOf(recordId, rs.getRecord(recordId));
if(key.equals(setting.getKey())) return recordId;
}
} catch (RecordStoreException e) {
Log.p("Error reading record store - " + e.getMessage(), Log.ERROR);
}
return -1;
}