Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Verify its writeRecStore method, if you already have the first record saved only need to update their values ​​with setRecord. See an example we use here:</p> <pre><code> /** * Saves the current data. * */ public static void saveConfiguration() { // ... RecordStore recordStore = open(CONFIG_DB); if (recordStore != null) { byte byteArray[] = Persistence.packConfiguration(); try { if (recordStore.getNumRecords() == 2) { byte roolback[] = recordStore.getRecord(CURRENT); recordStore.setRecord(ROLLBACK, roolback, 0, roolback.length); recordStore.setRecord(CURRENT, byteArray, 0, byteArray.length); } else { recordStore.addRecord(byteArray, 0, byteArray.length); recordStore.addRecord(byteArray, 0, byteArray.length); } } catch (Exception ex) { ex.printStackTrace(); } } Persistence.close(recordStore); } /** * Packs the data and stores memory data into a byte array and returns it. * * @return The array of bytes with application data packed. */ private static byte[] packConfiguration() { byte byteArray[] = null; try { ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(); DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream); // starts packing the data into the byte array dataoutputstream.writeBoolean(Persistence.rememberLogin); dataoutputstream.writeBoolean(Persistence.sounds); dataoutputstream.writeInt(Persistence.fontSize); dataoutputstream.writeInt(Persistence.idiom); dataoutputstream.writeUTF((Persistence.msg == null ? "" : Persistence.msg)); dataoutputstream.writeInt(Persistence.availability); // ... // end of packing byteArray = bytearrayoutputstream.toByteArray(); dataoutputstream.close(); } catch (Exception ex) { ex.printStackTrace(); } return byteArray; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload