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


Java RecordStore.enumerateRecords方法代码示例

本文整理汇总了Java中javax.microedition.rms.RecordStore.enumerateRecords方法的典型用法代码示例。如果您正苦于以下问题:Java RecordStore.enumerateRecords方法的具体用法?Java RecordStore.enumerateRecords怎么用?Java RecordStore.enumerateRecords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.microedition.rms.RecordStore的用法示例。


在下文中一共展示了RecordStore.enumerateRecords方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readbestscore

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
/**
 * ��ȡ�����Ϸ��¼
 * @return ��ѷ���
 * @throws RecordStoreException 
 * @throws  
 * @throws Exception 
 */
private int readbestscore() throws Exception
{
	RecordStore rsb=RecordStore.openRecordStore("DanceBest", true);
	RecordEnumeration renum= rsb.enumerateRecords(null, null, false);
	if(renum.hasNextElement())
	{
		System.out.println("��ȡ��Ѽ�¼��...");
		int temp= Integer.parseInt(new String(renum.nextRecord()));
		rsb.closeRecordStore();
		return temp;
	}
	else
	{
		System.out.println("û����Ѽ�¼...");
		rsb.closeRecordStore();
		return 0;
	}
	
}
 
开发者ID:cabbage89,项目名称:danceGame,代码行数:27,代码来源:Main.java

示例2: Config

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
public Config(WandersmannMIDlet midlet) {
	this.midlet = midlet;
	try {
		RecordStore config = RecordStore.openRecordStore("config", true);
		
		RecordEnumeration configKeys = config.enumerateRecords(null, null, false);
		while(configKeys.hasNextElement()) {
			String kv = new String(configKeys.nextRecord());
			Vector vkv = StringTokenizer.getVector(kv, "=");
			keys.put(vkv.elementAt(0), vkv.elementAt(1));
		}
		
		configKeys.destroy();
		config.closeRecordStore();
	} catch(RecordStoreException ex) {
		midlet.getDebugDialog().addMessage("Exception", ex.getMessage());
	}
}
 
开发者ID:cli,项目名称:worldmap-classic,代码行数:19,代码来源:Config.java

示例3: testAddRecordDeleteRecord2

import javax.microedition.rms.RecordStore; //导入方法依赖的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

示例4: record

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
/**
 * ��¼�˴���Ϸ��¼
 * @throws RecordStoreException 
 * @throws RecordStoreFullException 
 * @throws RecordStoreNotOpenException 
 */
private void record() throws Exception
{
	//-------------------
	//������Ѽ�¼
	RecordStore rsb=RecordStore.openRecordStore("DanceBest", true);
	RecordEnumeration renum= rsb.enumerateRecords(null, null, false);
	if(renum.hasNextElement())
	{
		int prebestscore= Integer.parseInt(new String(renum.nextRecord()));
		System.out.println("��ʷ��߷�:"+prebestscore);
		if(prebestscore<currentScore)
		{
			//renum.numRecords();//��ǰrecordid
			rsb.setRecord(renum.numRecords(), (currentScore+"").getBytes(), 0, (currentScore+"").getBytes().length);
			System.out.println("��Ѽ�¼���³ɹ�...");
		}
	}
	else
	{
		rsb.addRecord((currentScore+"").getBytes(), 0, (currentScore+"").getBytes().length);
		System.out.println("��Ѽ�¼����ɹ�...");
	}
	rsb.closeRecordStore();
	//--------------------
	RecordStore rs=RecordStore.openRecordStore("Dance", true);
	String score=currentScore+"";	//����
	String actioncount=""+ActionCount;	//�����Ѷ�
	String actionrepeat=""+ActionRepeat;	//�ظ�����
	String currentlift=currentLift+"";	//��ǰ����
	//���˳���ܱ�
	rs.addRecord(score.getBytes(), 0, score.getBytes().length);	//id:1,����
	rs.addRecord(actioncount.getBytes(), 0, actioncount.getBytes().length);	//id:2,�����Ѷ�
	rs.addRecord(actionrepeat.getBytes(), 0, actionrepeat.getBytes().length);	//�ظ�����
	rs.addRecord(currentlift.getBytes(), 0, currentlift.getBytes().length);	//��ǰ����
	rs.closeRecordStore();
	
	System.out.println("�����¼�ɹ�...");
}
 
开发者ID:cabbage89,项目名称:danceGame,代码行数:45,代码来源:MyCanvas.java

示例5: RMSInputStream

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
public RMSInputStream(short key) throws IOException {
            this.key = key;
            RecordStore r = null;
            RecordEnumeration e = null;
            char letter = 'A';
            try {
                ByteArrayOutputStream os = new ByteArrayOutputStream();
                r = open("" + letter + key);
                while(r != null) {
                    e = r.enumerateRecords(null, null, false);
                    while(e.hasNextElement()) {
                        byte[] data = e.nextRecord();
                        os.write(data);
                    }
                    e.destroy();
                    r.closeRecordStore();
                    letter++;
                    r = open("" + letter + key);
                    if(letter == 'Z') {
                        letter = 'a' - ((char)1);
                    }
                }
                os.close();
                current = new ByteArrayInputStream(os.toByteArray());
            } catch (RecordStoreException ex) {
                //#ifndef RIM
                ex.printStackTrace();
                //#else
//#                 System.out.println("Exception in object store input stream constructor: " + ex);
                //#endif
                cleanup(r);
                cleanup(e);
                throw new IOException(ex.toString());
            }
        }
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:36,代码来源:GameCanvasImplementation.java

示例6: RMSInputStream

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
public RMSInputStream(short key) throws IOException {
    this.key = key;
    RecordStore r = null;
    RecordEnumeration e = null;
    char letter = 'A';
    try {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        r = open("" + letter + key);
        while (r != null) {
            e = r.enumerateRecords(null, null, false);
            while (e.hasNextElement()) {
                byte[] data = e.nextRecord();
                os.write(data);
            }
            e.destroy();
            r.closeRecordStore();
            letter++;
            r = open("" + letter + key);
            if (letter == 'Z') {
                letter = 'a' - ((char) 1);
            }
        }
        os.close();
        current = new ByteArrayInputStream(os.toByteArray());
    } catch (RecordStoreException ex) {
        ex.printStackTrace();
        cleanup(r);
        cleanup(e);
        throw new IOException(ex.toString());
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:32,代码来源:BlackBerryImplementation.java

示例7: readhistory

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
/**
 * ��ȡ�ϴ���Ϸ��¼
 * @throws RecordStoreException 
 * @throws RecordStoreNotFoundException 
 * @throws RecordStoreFullException 
 */
private void readhistory() throws Exception
{
	RecordStore rs=RecordStore.openRecordStore("Dance", false);
	RecordEnumeration renum= rs.enumerateRecords(null, null, false);
	int i=1;	//����˳���ܴ���
	while(renum.hasNextElement())
	{
		if(i>4)
		{
			//ֻ��4����¼
			break;
		}
		switch (i) {
		case 1:
			currentLift=Integer.parseInt(new String(renum.nextRecord()));
			System.out.println("����:"+currentLift);
			i++;
			break;
		case 2:
			ActionRepeat=Integer.parseInt(new String(renum.nextRecord()));
			System.out.println("�Ѷ��ظ�����:"+ActionRepeat);
			i++;
			break;
		case 3:
			ActionCount=Integer.parseInt(new String(renum.nextRecord()));
			System.out.println("�Ѷȼ���:"+ActionCount);
			i++;
			break;
		case 4:
			currentScore=Integer.parseInt(new String(renum.nextRecord()));
			System.out.println("����:"+currentScore);
			i++;
			break;
		default:
			break;
		}
	}
	rs.closeRecordStore();
	RecordStore.deleteRecordStore("Dance");
	System.out.println("��¼����� ...");
}
 
开发者ID:cabbage89,项目名称:danceGame,代码行数:48,代码来源:MyCanvas.java

示例8: init

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
/**
 * @inheritDoc
 */
public void init(Object m) {
    canvas = createCanvas();
    canvas.setTitle(null);
    if(!disableFullScreen) {
        canvas.setFullScreenMode(!com.codename1.ui.Display.getInstance().isNativeCommands());
    }

    // disable the flashGraphics bug on Nokia phones
    String platform = System.getProperty("microedition.platform");
    if (platform != null && platform.toUpperCase().indexOf("NOKIA") >= 0) {
        flushGraphicsBug = false;
        NOKIA = true;

        // Symbian devices should yield a bit to let the paint thread complete its work
        // problem is we can't differentiate S40 from S60...
        Display.getInstance().setTransitionYield(1);
        //nokia devices cannot use OutputStreamWriter flush when using 
        //MultipartRequest
        MultipartRequest.setCanFlushStream(false);
    } else {
        flushGraphicsBug = true;
        Display.getInstance().setTransitionYield(-1);
    }
    mid = (MIDlet)m;
    display = javax.microedition.lcdui.Display.getDisplay(mid);
    setSoftKeyCodes(mid);

    if(mid.getAppProperty("forceBackCommand") != null) {
        canvas.setCommandListener((CommandListener) canvas);
        canvas.addCommand(MIDP_BACK_COMMAND);
    }
    
    RecordEnumeration e = null;
    RecordStore r = null;
    try {
        r = RecordStore.openRecordStore("FAT", true);
        if (r.getNumRecords() > 0) {
            e = r.enumerateRecords(null, null, false);
            while (e.hasNextElement()) {
                byte[] rec = e.nextRecord();
                ByteArrayInputStream bi = new ByteArrayInputStream(rec);
                DataInputStream di = new DataInputStream(bi);
                String name = di.readUTF();
                short key = di.readShort();
                di.close();
                bi.close();
                fat.put(name, new Short(key));
                if(key >= currentKey) {
                    currentKey += key;
                }
            }
            e.destroy();
            e = null;
        }
        r.closeRecordStore();
        r = null;
    } catch (Exception ex) {
        ex.printStackTrace();
        cleanup(r);
        cleanup(e);
    }        
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:66,代码来源:GameCanvasImplementation.java


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