Package | Description |
---|---|
ca.randolf.util |
Convenient utility classes that help make commonly needed programming
tasks easier.
|
Modifier and Type | Method and Description |
---|---|
Prefs |
Prefs.append(String key,
String... values)
Appends the specified String(s) to the underlying (or newly created)
ArrayList<String> for the given key.
|
Prefs |
Prefs.appendMax(int maximum,
String key,
String... values)
Appends the specified String(s) to the underlying (or newly created)
ArrayList<String> for the given key without exceeding the maximum
number specified. This is useful for maintaining a "most recently used"
list (in the spirit of user-friendly design, I suggest using a higher maximum
number rather than a lower maximum, such as 42 instead of 10).
|
Prefs |
Prefs.appendMax(String key,
String... values)
Appends the specified String(s) to the underlying (or newly created)
ArrayList<String> for the given key without exceeding the maximum
number specified by the setPolicyAppendMax() method. This is useful for
maintaining a "most recently used" list.
|
Prefs |
Prefs.load()
Attempt to read the contents of the configuration file. If the file
does not exist, or any read error occurs, then the isLoaded() method will
return FALSE from this point forward.
|
Prefs |
Prefs.loadPassive()
Attempt to read the contents of the configuration file. If the file
does not exist, or any read error occurs, then the isLoaded() method will
return FALSE from this point forward.
|
Prefs |
Prefs.remove(String key)
Removes the underlying ArrayList<String> for the given key (if it
exists) so that its entry will be deleted from memory, and consequently also
effectively be deleted from the contents of the configuration data upon the
next save operation.
|
Prefs |
Prefs.save()
Attempt to save the contents of the configuration file. If the file
can not be overwritten or created, or any write error occurs, then the
isSaved() method will return FALSE from this point forward.
|
Prefs |
Prefs.saveAs(java.io.File filename)
Attempt to save the contents of the configuration data in the alternative
filename that was specified. If the file can not be overwritten or
created, or any write error occurs, then the isSaved() method will return
FALSE from this point forward.
|
Prefs |
Prefs.saveAs(java.nio.file.Path filename)
Attempt to save the contents of the configuration data in the alternative
filename that was specified. If the file can not be overwritten or
created, or any write error occurs, then the isSaved() method will return
FALSE from this point forward.
|
Prefs |
Prefs.saveAs(String filename)
Attempt to save the contents of the configuration data in the alternative
filename that was specified. If the file can not be overwritten or
created, or any write error occurs, then the isSaved() method will return
FALSE from this point forward.
|
Prefs |
Prefs.savePassive()
Attempt to save the contents of the configuration file. If the file
can not be overwritten or created, or any write error occurs, then the
isSaved() method will return FALSE from this point forward.
|
Prefs |
Prefs.set(String key,
int index,
String value)
Sets or replaces the specified String in the underlying (or newly created)
ArrayList<String> for the given key. If the ArrayList does not
contain enough elements, then the missing number of empty String objects will
be inserted automatically.
|
Prefs |
Prefs.set(String key,
String... values)
Creates or replaces the underlying ArrayList<String> for the given
key, and populates it with the specified String(s).
|
Prefs |
Prefs.setArrayList(String key,
ArrayList<String> array)
Sets or replaces the underlying ArrayList<String> for the given key.
|
Prefs |
Prefs.setPolicyAppendDuplicates(boolean policy)
Specifies the policy on whether all values stored by any method whose name
begins with the word "append" are unique. This is disabled by default,
which means that duplicate values will be eliminated on-the-fly whenever a
method beginning with the word "append" is called.
|
Prefs |
Prefs.setPolicyAppendMax(int policy)
Specifies the policy for the maximum elements default used by any method
whose name begins with the word "appendMax" (the default is 42).
|
Prefs |
Prefs.setPolicyEqualSign(boolean policy)
Specifies the policy about whether one equal sign is a delimiter between
keys and values (whitespace characters present in the delimiter set will
still be consumed and discarded as expected).
|
Prefs |
Prefs.setPolicyKeepEmptyFile(boolean policy)
Indicates the policy about whether to keep an empty configuration file
(which is 0 bytes) or to delete it (default).
|
Prefs |
Prefs.setReadOnly()
Indicates that the configuration data cannot be saved. Setting this
flag is an irreversible operation (i.e., once this flag has been set to TRUE,
it can never be reverted back to FALSE).
|