public class ListFile
extends java.lang.Object
Whitespace at both ends of the strings will be striped when reading and writing. An empty string will be stored as a single "\" backslash character, while null values will generally be ignored when writing.
A line that starts with a "#" hash character is considered a comment. Comment lines are
ignored when reading, but you may include them in the file by adding them to the list.
Constructor and Description |
---|
ListFile(java.io.File file) |
Modifier and Type | Method and Description |
---|---|
java.io.File |
getFile()
Returns the file this class was instantiated with.
|
java.util.List<java.lang.String> |
load()
Loads the list from the file specified with the constructor.
|
void |
store(java.util.List<java.lang.String> list)
Stores the specified list in the file supplied with the constructor.
|
void |
store(java.util.List<java.lang.String> list,
boolean append)
Stores the specified list in the file supplied with the constructor.
|
public java.io.File getFile()
public java.util.List<java.lang.String> load() throws java.io.IOException
java.io.IOException
- if the list could not be written for any reasonpublic void store(java.util.List<java.lang.String> list) throws java.io.IOException
store( list, false )
. See class comment for further details.list
- to be saved to the file systemjava.io.IOException
public void store(java.util.List<java.lang.String> list, boolean append) throws java.io.IOException
list
- to be saved to the file systemappend
- set to true to append to the specified filejava.io.IOException