Modifier and Type | Class and Description |
---|---|
protected static class |
Properties.Layout
TODO
|
static class |
Properties.PropertiesReader
This class is used to read properties lines.
|
static class |
Properties.PropertiesWriter
This class is used to write properties lines.
|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
Properties() |
Properties(File location) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
static boolean |
contains(char[] array,
char valueToFind)
Checks if the value is in the given array.
|
Set<Map.Entry<String,String>> |
entrySet() |
protected static String |
escapeJava(String str)
Escapes the characters in a
String using Java String rules. |
List<String> |
getFooter()
Return the comment footer.
|
List<String> |
getHeader()
Return the comment header.
|
protected static String |
hex(char ch)
Returns an upper case hexadecimal
String for the given
character. |
void |
load(File location) |
void |
load(InputStream is) |
void |
load(Reader reader) |
void |
load(URL location) |
protected void |
loadLayout(Reader in)
Reads a properties file and stores its internal structure.
|
String |
put(String key,
String value) |
String |
remove(Object key) |
void |
save() |
void |
save(File location) |
void |
save(OutputStream os) |
void |
save(Writer writer) |
protected void |
saveLayout(Writer out)
Writes the properties file to the given writer, preserving as much of its
structure as possible.
|
void |
setFooter(List<String> footer)
Set the comment footer.
|
void |
setHeader(List<String> header)
Set the comment header.
|
protected static String |
unescapeJava(String str)
Unescapes any Java literals found in the
String to a
Writer . |
clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, size, toString, values
public Properties()
public Properties(File location) throws IOException
IOException
public void load(File location) throws IOException
IOException
public void load(URL location) throws IOException
IOException
public void load(InputStream is) throws IOException
IOException
public void load(Reader reader) throws IOException
IOException
public void save() throws IOException
IOException
public void save(File location) throws IOException
IOException
public void save(OutputStream os) throws IOException
IOException
public void save(Writer writer) throws IOException
IOException
public void clear()
public void setHeader(List<String> header)
header
- the header to usepublic void setFooter(List<String> footer)
footer
- the footer to useprotected void loadLayout(Reader in) throws IOException
in
- the reader to the properties fileIOException
- if an error occursprotected void saveLayout(Writer out) throws IOException
out
- the writerIOException
- if an error occursprotected static String unescapeJava(String str)
Unescapes any Java literals found in the String
to a
Writer
.
str
- the String
to unescape, may be nullIllegalArgumentException
- if the Writer is null
protected static String escapeJava(String str)
Escapes the characters in a String
using Java String rules.
Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.)
So a tab becomes the characters '\\'
and
't'
.
The only difference between Java strings and JavaScript strings is that in JavaScript, a single quote must be escaped.
Example:
input string: He didn't say, "Stop!" output string: He didn't say, \"Stop!\"
str
- String to escape values in, may be nullnull
if null string inputprotected static String hex(char ch)
Returns an upper case hexadecimal String
for the given
character.
ch
- The character to convert.String
public static boolean contains(char[] array, char valueToFind)
Checks if the value is in the given array.
The method returns false
if a null
array is passed in.
array
- the array to search throughvalueToFind
- the value to findtrue
if the array contains the objectCopyright © 2006-2012 Apache Software Foundation. All Rights Reserved.