Posted by netomarin
on June 12, 2008 at 8:20 AM PDT
A little implementation of Properties class to JME. A simple way to read and store data!
These days I had to store and travel some settings of mobile applications. So, to get my life easier decided to use the scheme properties. That is, a key = value. And you may think I am getting crazy, right !?!? Because, neither JME has the implementation of the class Properties and there is also the device must implement the JSR 75 in order to save the properties in "format" of file.
But using properties I have some advantages:
- Standardization in the form of assembly of data
- There is no need to make many parses ultimately the form of composition is quite simple!
- Cause little additional data. Compare with XML! =)
And besides the benefits, you not just have to save a file. As the implementation of class Properties in JSE, you can get an OutputStream and so, generate a ByteArrayOutputStream getting an array of bytes and save to an RMS! =)You can also receive a file properties sent by a HTTP and using InputStream, load the properties of an automatic and transparent!
Who is interested, just click here to download the zip file containing the .java file with my implementation! Feel free to use, modify and do whatever you want!!
The class does not implement ALL the methods of the "original" JSE Properties because I did not have time and because I am not interested when created. But I think we can make life easier for some!