public class MapUtils
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
MapUtils()
Don't allow instantiation, do allow overrides.
|
Modifier and Type | Method and Description |
---|---|
static java.util.Map<java.lang.String,java.lang.String> |
loadMap(java.io.File mapFile,
java.lang.String separator,
java.lang.String qualifier,
java.lang.String encoding)
Load string map from a file.
|
static java.util.Map<java.lang.String,java.lang.String> |
loadMap(java.lang.String mapFileName)
Load string map from a file name.
|
static java.util.Map<java.lang.String,java.lang.String> |
loadMap(java.lang.String mapFileName,
java.lang.String separator,
java.lang.String qualifier,
java.lang.String encoding)
Load string map from a file name.
|
static java.util.Map<java.lang.String,java.lang.String> |
loadMap(java.net.URL mapURL,
java.lang.String separator,
java.lang.String qualifier,
java.lang.String encoding)
Load string map from a URL.
|
static void |
saveMap(java.util.Map<?,?> map,
java.io.File mapFile,
java.lang.String separator,
java.lang.String qualifier,
java.lang.String encoding)
Save map to a file.
|
static void |
saveMap(java.util.Map<?,?> map,
java.lang.String mapFileName)
Save map to a file name.
|
static void |
saveMap(java.util.Map<?,?> map,
java.lang.String mapFileName,
java.lang.String separator,
java.lang.String qualifier,
java.lang.String encoding)
Save map to a file name.
|
static void |
saveSortedMap(java.util.Map<?,?> map,
java.io.File mapFile,
java.lang.String separator,
java.lang.String qualifier,
java.lang.String encoding)
Save map to a file in sorted key order.
|
static void |
saveSortedMap(java.util.Map<?,?> map,
java.lang.String mapFileName,
java.lang.String separator,
java.lang.String qualifier,
java.lang.String encoding)
Save map to a file name in sorted key order.
|
public static java.util.Map<java.lang.String,java.lang.String> loadMap(java.net.URL mapURL, java.lang.String separator, java.lang.String qualifier, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
mapURL
- URL for map file.separator
- Field separator.qualifier
- Quote character.encoding
- Character encoding for the file.java.io.FileNotFoundException
- If input file does not exist.java.io.IOException
- If input file cannot be opened.public static java.util.Map<java.lang.String,java.lang.String> loadMap(java.io.File mapFile, java.lang.String separator, java.lang.String qualifier, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
mapFile
- Map file.separator
- Field separator.qualifier
- Quote character.encoding
- Character encoding for the file.java.io.FileNotFoundException
- If input file does not exist.java.io.IOException
- If input file cannot be opened.public static java.util.Map<java.lang.String,java.lang.String> loadMap(java.lang.String mapFileName, java.lang.String separator, java.lang.String qualifier, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
mapFileName
- Map file name.separator
- Field separator.qualifier
- Quote character.encoding
- Character encoding for the file.java.io.FileNotFoundException
- If input file does not exist.java.io.IOException
- If input file cannot be opened.public static java.util.Map<java.lang.String,java.lang.String> loadMap(java.lang.String mapFileName) throws java.io.IOException, java.io.FileNotFoundException
mapFileName
- Map file name.Map is assumed to be utf-8 encoded and have tab-separated values.
java.io.FileNotFoundException
- If input file does not exist.java.io.IOException
- If input file cannot be opened.public static void saveMap(java.util.Map<?,?> map, java.io.File mapFile, java.lang.String separator, java.lang.String qualifier, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
map
- Map to save.mapFile
- Output file name.separator
- Field separator.qualifier
- Quote character.encoding
- Character encoding for the file.java.io.IOException
- If output file has error.java.io.FileNotFoundException
public static void saveMap(java.util.Map<?,?> map, java.lang.String mapFileName, java.lang.String separator, java.lang.String qualifier, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
map
- Map to save.mapFileName
- Output file name.separator
- Field separator.qualifier
- Quote character.encoding
- Character encoding for the file.java.io.IOException
- If output file has error.java.io.FileNotFoundException
public static void saveMap(java.util.Map<?,?> map, java.lang.String mapFileName) throws java.io.IOException, java.io.FileNotFoundException
map
- Map to save.mapFileName
- Output file name.java.io.IOException
- If output file has error.
The map is saved with utf-8 encoding and a tab character separating the value from the key.
java.io.FileNotFoundException
public static void saveSortedMap(java.util.Map<?,?> map, java.io.File mapFile, java.lang.String separator, java.lang.String qualifier, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
map
- Map to save.mapFile
- Output file name.separator
- Field separator.qualifier
- Quote character.encoding
- Character encoding for the file.java.io.IOException
- If output file has error.java.io.FileNotFoundException
public static void saveSortedMap(java.util.Map<?,?> map, java.lang.String mapFileName, java.lang.String separator, java.lang.String qualifier, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
map
- Map to save.mapFileName
- Output file name.separator
- Field separator.qualifier
- Quote character.encoding
- Character encoding for the file.java.io.IOException
- If output file has error.java.io.FileNotFoundException