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


Java RecordStore.deleteRecordStore方法代码示例

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


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

示例1: testAddRecordDeleteRecord1

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
@Test
public void testAddRecordDeleteRecord1() throws RecordStoreException {
    assertNull(RecordStore.listRecordStores());
    String storeName = "testAddRecordDeleteRecord1";
    RecordStore store = RecordStore.openRecordStore(storeName, true);
    byte[] record = new byte[1024];
    int count = 0;
    long startingSequence = ImpGlobal.getRecordStoreManagerErasedSequenceCurrentValue();
    while ((ImpGlobal.getRecordStoreManagerErasedSequenceCurrentValue() - startingSequence) < erasedSequenceCount) {
        fill(record, count);
        int recordId = store.addRecord(record, 0, record.length);
        fill(record, (byte) (count+1));
        byte[] bytes = store.getRecord(recordId);
        assertEquals(record, record.length, (byte) (count + 1));
        assertEquals(bytes, bytes.length, (byte) count);
        store.deleteRecord(recordId);
        try {
            store.getRecord(recordId);
            fail();
        } catch (InvalidRecordIDException e) {
        }
        count++;
    }
    store.closeRecordStore();
    RecordStore.deleteRecordStore(storeName);
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:27,代码来源:RecordStoreIntegrationTest.java

示例2: testSetRecord1

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
@Test
public void testSetRecord1() throws RecordStoreException {
    assertNull(RecordStore.listRecordStores());
    String storeName = "testSetRecord1";
    RecordStore store = RecordStore.openRecordStore(storeName, true);
    byte[] record = new byte[1024];
    int count = 0;
    int recordId = store.addRecord(record, 0, record.length);
    long startingSequence = ImpGlobal.getRecordStoreManagerErasedSequenceCurrentValue();
    while ((ImpGlobal.getRecordStoreManagerErasedSequenceCurrentValue() - startingSequence) < erasedSequenceCount) {
        fill(record, count);
        store.setRecord(recordId, record, 0, record.length);
        byte[] bytes = store.getRecord(recordId);
        assertEquals(bytes, bytes.length, count);
        count++;
    }
    assertTrue(count > 0);
    store.closeRecordStore();
    RecordStore.deleteRecordStore(storeName);
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:21,代码来源:RecordStoreIntegrationTest.java

示例3: store

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
private void store() {
	try {
		RecordStore.deleteRecordStore("config");
		RecordStore config = RecordStore.openRecordStore("config", true);

		Enumeration k = this.keys.keys();
		while(k.hasMoreElements()) {
			String key = (String)k.nextElement();
			byte[] buf = (key + "=" + (String)this.keys.get(key)).getBytes();
			config.addRecord(buf, 0, buf.length);
		}

		config.closeRecordStore();
	} catch(RecordStoreException ex) {
		ex.printStackTrace();
	}
}
 
开发者ID:cli,项目名称:worldmap-classic,代码行数:18,代码来源:Config.java

示例4: uninstall

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
private void uninstall() throws Exception {
	messages.deleteAll();
	messages.append("Uninstalling..."+'\n');
	HashMap instCfg = installer.getInstalledConfig();
	//purging filesystem
	if (question("Do you want to erase internal file system?")) {
		if (instCfg.get(Installer.FS_DRIVER).equals("rms")) {
			try {
				RecordStore.deleteRecordStore((String)instCfg.get("rms.name"));
				messages.append("File system erased"+'\n');
			} catch (RecordStoreException rse) { }
		}
	}
	//removing config
	installer.removeInstalledConfig();
	messages.append("Configuration removed"+'\n');
}
 
开发者ID:SBasalaev,项目名称:alchemy-os,代码行数:18,代码来源:InstallerMIDlet.java

示例5: 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

示例6: testAddRecordDeleteStore1

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
@Test
public void testAddRecordDeleteStore1() throws RecordStoreException {
    assertNull(RecordStore.listRecordStores());
    byte[] record = new byte[1024];
    int firstCountAdd = -1;
    for (int i=0; i < 4; i++) {
        String storeName = "testAddRecordDeleteStore1";
        RecordStore store = RecordStore.openRecordStore(storeName, true);
        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 * 90 / 100;
        } else {
            assertTrue(countAdd >= firstCountAdd);
        }
        store.closeRecordStore();
        RecordStore.deleteRecordStore(storeName);
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:28,代码来源:RecordStoreIntegrationTest.java

示例7: testAddStoreDeleteStore1

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
@Test
public void testAddStoreDeleteStore1() throws RecordStoreException {
    assertNull(RecordStore.listRecordStores());
    int count = 0;
    long startingSequence = ImpGlobal.getRecordStoreManagerErasedSequenceCurrentValue();
    while ((ImpGlobal.getRecordStoreManagerErasedSequenceCurrentValue() - startingSequence) < erasedSequenceCount) {
        String storeName = "testAddStoreDeleteStore1_" + count;
        RecordStore store = RecordStore.openRecordStore(storeName, true);
        store.closeRecordStore();
        RecordStore.deleteRecordStore(storeName);
        count++;
    }
    assertTrue(count > 0);
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:15,代码来源:RecordStoreIntegrationTest.java

示例8: deleteStorageFile

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
/**
 * @inheritDoc
 */
public void deleteStorageFile(String name) {
    Short key = (Short)fat.get(name);
    fat.remove(name);
    resaveFat();
    if(key != null) {
        try {
            for(char c = 'A' ; c < 'Z' ; c++) {
                RecordStore.deleteRecordStore("" + c + key);
            }
        } catch(RecordStoreException e) {}
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:16,代码来源:GameCanvasImplementation.java

示例9: RMSOutputStream

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
public RMSOutputStream(short key) {
    this.key =  key;

    // first we need to cleanup existing files
    try {
        for(char c = 'A' ; c < 'Z' ; c++) {
            RecordStore.deleteRecordStore("" + c + key);
        }
    } catch(RecordStoreException e) {}

    cache = new ByteArrayOutputStream();
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:13,代码来源:GameCanvasImplementation.java

示例10: deleteStorageFile

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
/**
 * @inheritDoc
 */
public void deleteStorageFile(String name) {
    Short key = (Short) fat.get(name);
    fat.remove(name);
    resaveFat();
    if (key != null) {
        try {
            for (char c = 'A'; c < 'Z'; c++) {
                RecordStore.deleteRecordStore("" + c + key);
            }
        } catch (RecordStoreException e) {
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:17,代码来源:BlackBerryImplementation.java

示例11: RMSOutputStream

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
public RMSOutputStream(short key) {
    this.key = key;

    // first we need to cleanup existing files
    try {
        for (char c = 'A'; c < 'Z'; c++) {
            RecordStore.deleteRecordStore("" + c + key);
        }
    } catch (RecordStoreException e) {
    }

    cache = new ByteArrayOutputStream();
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:14,代码来源:BlackBerryImplementation.java

示例12: lowMemAction

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
/**
 * Completely frees the cache contents.
 */
private void lowMemAction() {
	try {
		this.rsImages.closeRecordStore();
		this.rsIndex.closeRecordStore();
		RecordStore.deleteRecordStore("images");
		RecordStore.deleteRecordStore("index");
		initialize(); // Reinitialize
	} catch(RecordStoreException ex) {
		midlet.getDebugDialog().addMessage("Excp", ex.getMessage());
		ex.printStackTrace();
	}
}
 
开发者ID:cli,项目名称:worldmap-classic,代码行数:16,代码来源:RMSTileCache.java

示例13: delete

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
private void delete() {
	try {
		RecordStore.deleteRecordStore(recordStoreName);
		messageItem.setText("removed " + recordStoreName);
	} catch (Throwable e) {
		System.out.println("error accessing RecordStore");
		e.printStackTrace();
		messageItem.setText(e.toString());
	} 	
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:11,代码来源:RecordStoreForm.java

示例14: remove

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
public void remove() {
	try {
		config.clear();
		RecordStore.deleteRecordStore(INSTALLINFO);
		isInstalled = false;
	} catch (RecordStoreNotFoundException rsnfe) {
		// already removed
	} catch (Exception e) {
		throw new RuntimeException(e.toString());
	}
}
 
开发者ID:SBasalaev,项目名称:alchemy-os,代码行数:12,代码来源:InstallCfg.java

示例15: rebuildFileSystem

import javax.microedition.rms.RecordStore; //导入方法依赖的package包/类
/** Should be only available when RMS file system is in use. */
private void rebuildFileSystem() throws Exception {
	messages.deleteAll();
	messages.append("Optimizing RMS filesystem...\n");
	// opening old FS
	HashMap cfg = installer.getInstalledConfig();
	String oldname = (String)cfg.get("rms.name");
	Driver oldfs = new Driver();
	long oldlen = oldfs.spaceUsed();
	// creating new FS
	String newname = (oldname.equals("rsfiles")) ? "rsfiles2" : "rsfiles";
	cfg.set("rms.name", newname);
	try {
		RecordStore.deleteRecordStore(newname);
	} catch (RecordStoreException rse) { }
	Driver newfs = new Driver();
	// copying all files from the old FS to the new
	String[] list = oldfs.list("");
	for (int i=0; i<list.length; i++) {
		copyTree(oldfs, newfs, "/"+list[i]);
	}
	oldfs.close();
	// computing new len
	newfs.close();
	newfs = new Driver();
	long newlen = newfs.spaceUsed();
	newfs.close();
	// writing configuration
	messages.append("Saving configuration...\n");
	cfg.set("rms.name", newname);
	installer.saveInstalledConfig();
	// removing old FS
	RecordStore.deleteRecordStore(oldname);
	messages.append("Optimization complete.\n");
	messages.append("" + (oldlen - newlen) + " bytes saved.\n");
}
 
开发者ID:SBasalaev,项目名称:alchemy-os,代码行数:37,代码来源:InstallerMIDlet.java


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