|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.addressbook.ConfigParser
public class ConfigParser
Utility class providing methods to parse and write files in config file format, and subscription file format. TODO: Change file encoding from default to UTF-8? Or switch to the DataHelper loadProps/storeProps methods?
Constructor Summary | |
---|---|
ConfigParser()
|
Method Summary | |
---|---|
static Map |
parse(BufferedReader input)
Return a Map using the contents of BufferedReader input. |
static Map |
parse(File file)
Return a Map using the contents of the File file. |
static Map |
parse(File file,
Map map)
Return a Map using the contents of the File file. |
static Map |
parse(String string)
Return a Map using the contents of the String string. |
static List |
parseSubscriptions(BufferedReader input)
Return a List where each element is a line from the BufferedReader input. |
static List |
parseSubscriptions(File file)
Return a List where each element is a line from the File file. |
static List |
parseSubscriptions(File file,
List list)
Return a List using the contents of the File file. |
static List |
parseSubscriptions(String string)
Return a List where each element is a line from the String string. |
static String |
stripComments(String inputLine)
Strip the comments from a String. |
static void |
write(Map map,
BufferedWriter output)
Write contents of Map map to BufferedWriter output. |
static void |
write(Map map,
File file)
Write contents of Map map to the File file. |
static void |
writeSubscriptions(List list,
BufferedWriter output)
Write contents of List list to BufferedReader output. |
static void |
writeSubscriptions(List list,
File file)
Write contents of List list to File file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConfigParser()
Method Detail |
---|
public static String stripComments(String inputLine)
inputLine
- A String to strip comments from.
public static Map parse(BufferedReader input) throws IOException
input
- A BufferedReader with lines in key=value format to parse into
a Map.
IOException
- if the BufferedReader cannot be read.public static Map parse(File file) throws IOException
file
- A File to parse.
IOException
- if file cannot be read.public static Map parse(String string) throws IOException
string
- A String to parse.
IOException
- if file cannot be read.public static Map parse(File file, Map map)
file
- A File to attempt to parse.map
- A Map to use as the default, if file fails.
public static List parseSubscriptions(BufferedReader input) throws IOException
input
- A BufferedReader to parse.
IOException
- if input cannot be read.public static List parseSubscriptions(File file) throws IOException
file
- A File to parse.
IOException
- if file cannot be read.public static List parseSubscriptions(String string) throws IOException
string
- A String to parse.
IOException
- if string cannot be read.public static List parseSubscriptions(File file, List list)
file
- A File to attempt to parse.list
- list of files to parse
public static void write(Map map, BufferedWriter output) throws IOException
map
- A Map to write to output.output
- A BufferedWriter to write the Map to.
IOException
- if the BufferedWriter cannot be written to.public static void write(Map map, File file) throws IOException
map
- A Map to write to file.file
- A File to write the Map to.
IOException
- if file cannot be written to.public static void writeSubscriptions(List list, BufferedWriter output) throws IOException
list
- A List to write to file.output
- A BufferedReader to write list to.
IOException
- if output cannot be written to.public static void writeSubscriptions(List list, File file) throws IOException
list
- A List to write to file.file
- A File to write list to.
IOException
- if output cannot be written to.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |