Persistent Storage: The LogStorage Class
Beneath the DayLog class for storing the log of a single day, we need another class to store all the DayLogs persistently. The LogStorage class uses a record store for that purpose.
In the constructor, the record store with the name "BloodSugarLog" is opened and assigned to the days object variable:
import javax.microedition.rms.*; import java.util.*; import java.io.*; import java.util.*; public class LogStorage { RecordStore days; public LogStorage () throws RecordStoreException { days = RecordStore.openRecordStore ("BloodSugarLog", true); } }
The most important functionality of the persistent storage is to provide efficient access to the day log of a specific date. If the logs are stored and put in ...
Get Java™ 2 Micro Edition Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.