Java Reference
In-Depth Information
StringBuffer fileURL = new StringBuffer(mFileRoot);
fileURL.append(mDirectoryName);
fileURL.append(fileExt);
try {
fc = (FileConnection) Connector.open(
fileURL.toString(), Connector.READ);
if (fc == null)
return;
if (!fc.exists()) {
return;
}
dis = fc.openDataInputStream();
String curInput;
while ( (curInput = dis.readUTF()) != null ) {
int index = curInput.indexOf('|');
String name = curInput.substring(0, index);
String value = curInput.substring(index + 1);
put(name, value);
}
} catch (Exception ex) {
// End of file detected the hard way.
}
finally {
if (dis != null) dis.close();
if (fc != null) fc.close();
}
}
public void save() {
Thread t = new Thread(this);
t.start();
}
public void run() {
mSaving = true;
try {
savePref();
} catch (IOException ex) {
}
mSaving = false;
}
public boolean isSaving() {
return mSaving;
}
Search WWH ::




Custom Search