Well, this is some ancient stuff, but the concept is still alive. I’m talking about isolated storages.
Isolated storage is a contrivance of data storing that allows external data to be stored in a special place on your device. Thus you can easily use external data but you are not allow to touch any sensitive files on the device. That is very usefull on mobile phones and internet apps where security is very important.
Coming back to the ancient stuff: I once made J2ME application that had to store some things on the device. I was searching through the internet for some clues on how to store files on the mobile device but I didn’t found much (I was some time ago though). All I found was an old Motorola document on how to use RecordStore that was using the idea of isolated storage. This is how it works:
SOURCE CODE(Imports):
import javax.microedition.rms.RecordEnumeration; import javax.microedition.rms.RecordStore; import javax.microedition.rms.RecordStoreException;
SOURCE CODE(Writing to RecordStore):
public void addToRS(String s, String rsName) { try { RecordStore rs = RecordStore.openRecordStore(rsName, true); byte bytes[] = s.getBytes(); rs.addRecord((bytes), 0, bytes.length); rs.closeRecordStore(); } catch (RecordStoreException ex) { //your exception handling } }
Note that in J2ME you don’t have to store RecordStore object in the memory. When you use RecordStore, you call it by name and when the RecordStore of the given name doesn’t exist it’s being created.
SOURCE CODE(Reading from RecordStore):
public void addAllFromRS(String rsName) { try { RecordStore rs = RecordStore.openRecordStore(rsName, true); RecordEnumeration re = rs.enumerateRecords(null, null, false); if (re.hasNextElement()) { byte b[] = re.nextRecord(); //this is how to get String object from RecordStore data: String s = new String(b,0,b.length) } } catch (RecordStoreException ex) { //your exception handling } }
Hi there, just become aware of your weblog thru Google, and found that it’s truly informative. I am going to watch out for brussels. I will be grateful if you proceed this in future. Lots of people will be benefited from your writing. Cheers!
I wanted to dratt you this little observation to be able to say
thank you the moment again with the superb strategies you’ve documented at this time.
It was incredibly open-handed of you to give
unreservedly just what many of us might have marketed for an e-book
in order to make some profit for their own end, most importantly since you could possibly have tried it in the event you desired.
Those tricks likewise acted like a easy way to comprehend some people have similar passion much
like my personal own to realize lots more related to this problem.
I am certain there are some more enjoyable situations
in the future for those who start reading your website.