class HostTxtParser extends Object
Constructor and Description |
---|
HostTxtParser() |
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args)
Usage: HostTxtParser [-q] validate example.i2p=b64dest[#!key1=val1#key2=val2]
|
static Map<String,HostTxtEntry> |
parse(File file)
Return a Map using the contents of the File file.
|
static Map<String,HostTxtEntry> |
parse(File file,
Map<String,HostTxtEntry> map)
Return a Map using the contents of the File file.
|
static HostTxtEntry |
parse(String inputLine,
boolean allowCommandOnly)
Return a HostTxtEntry from the contents of the inputLine.
|
static void |
write(Map<String,HostTxtEntry> map,
File file)
Write contents of Map map to the File file.
|
public static HostTxtEntry parse(String inputLine, boolean allowCommandOnly)
inputLine
- key=value[#!k1=v1#k2=v2...]allowCommandOnly
- if true, a line starting with #! will return
a HostTxtEntry with a null name and dest and non-null props.
If false, these lines will return null.public static Map<String,HostTxtEntry> parse(File file) throws IOException
file
- A File to parse.IOException
- if file cannot be read.public static Map<String,HostTxtEntry> parse(File file, Map<String,HostTxtEntry> map)
file
- A File to attempt to parse.map
- A Map containing values to use as defaults.public static void write(Map<String,HostTxtEntry> 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.