当前位置: 首页>>代码示例>>Java>>正文


Java RecordEnumeration.nextRecordId方法代码示例

本文整理汇总了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;
	}
}
 
开发者ID:wvdschel,项目名称:twitsy,代码行数:19,代码来源:TweetStorage.java

示例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;
	}
}
 
开发者ID:wvdschel,项目名称:twitsy,代码行数:19,代码来源:UserStorage.java

示例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;
	}
}
 
开发者ID:wvdschel,项目名称:twitsy,代码行数:19,代码来源:AccountStorage.java

示例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);
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:38,代码来源:RecordStoreIntegrationTest.java

示例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;
}
 
开发者ID:csperle,项目名称:KeePassMobile,代码行数:16,代码来源:RecordStoreSettings.java

示例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;
}
 
开发者ID:csperle,项目名称:KeePassMobile,代码行数:14,代码来源:RecordStoreSettings.java


注:本文中的javax.microedition.rms.RecordEnumeration.nextRecordId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。