public static class JSONUtils.CommonDataJSONObject extends JSONObject implements AutoCloseable
JSONObject
that allows saving and restoring its values to/from the common data
folder (saves/common). Use this to have global settings that persist between saves.NULL
Constructor and Description |
---|
CommonDataJSONObject(String filename)
Creates a new
JSONObject that will save to the provided filename in the common data folder. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Implemented as part of the
AutoCloseable interface. |
void |
save()
Saves this
JSONObject 's contents to common data. |
accumulate, append, doubleToString, get, getBoolean, getDouble, getInt, getJSONArray, getJSONObject, getLong, getNames, getNames, getString, has, increment, isNull, keys, length, names, numberToString, opt, optBoolean, optBoolean, optDouble, optDouble, optInt, optInt, optJSONArray, optJSONObject, optLong, optLong, optString, optString, put, put, put, put, put, put, put, putOnce, putOpt, quote, remove, sortedKeys, stringToValue, toJSONArray, toString, toString, write
public CommonDataJSONObject(String filename)
JSONObject
that will save to the provided filename in the common data folder.filename
- The filename to save to under the common data folder.public void save() throws JSONException, IOException
JSONObject
's contents to common data. You MUST call this if you want your data to persist!JSONException
IOException
public void close() throws Exception
AutoCloseable
interface. You will never need to call this.close
in interface AutoCloseable
Exception