public class SavedSettingsFile extends java.lang.Object implements java.lang.Iterable<Pair<java.lang.String,java.util.ArrayList<java.lang.String>>>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COMMENT_PREFIX
Comment prefix
|
private java.io.File |
file
File to read and write
|
private java.util.ArrayList<Pair<java.lang.String,java.util.ArrayList<java.lang.String>>> |
store
Data store
|
Constructor and Description |
---|
SavedSettingsFile(java.lang.String filename)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all saved settings.
|
java.util.ArrayList<java.lang.String> |
get(java.lang.String key)
Find a saved setting by key.
|
Pair<java.lang.String,java.util.ArrayList<java.lang.String>> |
getElementAt(int index)
Array access.
|
java.util.Iterator<Pair<java.lang.String,java.util.ArrayList<java.lang.String>>> |
iterator() |
void |
load()
Read the current file
|
void |
put(java.lang.String key,
java.util.ArrayList<java.lang.String> value)
Add/Replace a saved setting
|
void |
remove(java.lang.String key)
Remove a given key from the file.
|
void |
save()
Save the current data to the given file.
|
int |
size()
Return number of saved settings profiles.
|
public static final java.lang.String COMMENT_PREFIX
private java.io.File file
private java.util.ArrayList<Pair<java.lang.String,java.util.ArrayList<java.lang.String>>> store
public SavedSettingsFile(java.lang.String filename)
filename
- Filenamepublic void save() throws java.io.FileNotFoundException
java.io.FileNotFoundException
- thrown on output errors.public void load() throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
- thrown when file not foundjava.io.IOException
- thrown on IO errprspublic java.util.Iterator<Pair<java.lang.String,java.util.ArrayList<java.lang.String>>> iterator()
iterator
in interface java.lang.Iterable<Pair<java.lang.String,java.util.ArrayList<java.lang.String>>>
public void remove(java.lang.String key)
key
- Key to removepublic java.util.ArrayList<java.lang.String> get(java.lang.String key)
key
- Key to search forpublic void clear()
public void put(java.lang.String key, java.util.ArrayList<java.lang.String> value)
key
- Keyvalue
- (New) value.public int size()
public Pair<java.lang.String,java.util.ArrayList<java.lang.String>> getElementAt(int index)
index
- settings indexCopyright © 2019 ELKI Development Team. License information.