Delay multiple writes to FFS of EHS6T using buffering? | Telit Cinterion IoT Developer Community
June 17, 2018 - 6:29am, 1594 views
Hello,
So I am presently trying to avoid the risk of overusing FFS writes by adopting say the equivalent of BufferedWriter for J2ME on the EHS6T.
Because I am logging some records to a file many ***** a day, I would like a balance between writing all to RAM then risking losing data if the device should power off unexpectedly, and writing repeatedly to the FFS (when I say repeatedly I mean every minute multiplies by say about five rows or more per minute.
Is there a particular way anyone might recommend to write the data either to buffer or file so as to minimise the number of file writes to the FFS during its lifespan? I've read similar forum threads on this, but unfortunately cant seem to achieve it using buffer sizes.
Many thanks.
N.
Hello,
There is the class com.sun.midp.io.BufferedOutputStream available that you could use. It may not exist in the older versions of firmware and API.
As a block size of the flash memory of module's file system is 64KB and each block consists of pages and in case the page ***** to be updated the whole block ***** to be first deleted, the recommended size of BufferedOutputStream would be 64KB. That would also be good for performance as delete operations are more time consuming than others.
Best regards,
Bartłomiej
Hello Bartlomiej,
Yes, this is precisely what was needed thank you so much!
All advice you have provided in response to various queries of mine in these threads have helped greatly.
So thank you again as always :).
Kind regards,
Nick.