本文整理汇总了Java中javax.microedition.rms.RecordEnumeration.destroy方法的典型用法代码示例。如果您正苦于以下问题:Java RecordEnumeration.destroy方法的具体用法?Java RecordEnumeration.destroy怎么用?Java RecordEnumeration.destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.rms.RecordEnumeration
的用法示例。
在下文中一共展示了RecordEnumeration.destroy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Config
import javax.microedition.rms.RecordEnumeration; //导入方法依赖的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());
}
}
示例2: initialize
import javax.microedition.rms.RecordEnumeration; //导入方法依赖的package包/类
public boolean initialize() {
try {
this.rsIndex = RecordStore.openRecordStore("index", true);
RecordEnumeration indices = rsIndex.enumerateRecords(null, null, false);
this.keys.clear();
while(indices.hasNextElement()) {
byte[] buf = indices.nextRecord();
Vector indexChunks = StringTokenizer.getVector(new String(buf), "=");
keys.put(indexChunks.elementAt(0), indexChunks.elementAt(1));
}
indices.destroy();
rsImages = RecordStore.openRecordStore("images", true);
} catch(RecordStoreException ex) {
ex.printStackTrace();
this.isEnabled = false;
}
this.successor.initialize();
return true;
}
示例3: RMSInputStream
import javax.microedition.rms.RecordEnumeration; //导入方法依赖的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());
}
}
示例4: RMSInputStream
import javax.microedition.rms.RecordEnumeration; //导入方法依赖的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());
}
}
示例5: init
import javax.microedition.rms.RecordEnumeration; //导入方法依赖的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);
}
}