|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap<String,String>
org.apache.felix.utils.properties.Properties
public class Properties
Enhancement of the standard Properties
managing the maintain of comments, etc.
Nested Class Summary | |
---|---|
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. |
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Constructor Summary | |
---|---|
Properties()
|
|
Properties(File location)
|
Method Summary | |
---|---|
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 . |
Methods inherited from class java.util.AbstractMap |
---|
clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, size, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Properties()
public Properties(File location) throws IOException
IOException
Method Detail |
---|
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 Set<Map.Entry<String,String>> entrySet()
entrySet
in interface Map<String,String>
entrySet
in class AbstractMap<String,String>
public String put(String key, String value)
put
in interface Map<String,String>
put
in class AbstractMap<String,String>
public String remove(Object key)
remove
in interface Map<String,String>
remove
in class AbstractMap<String,String>
public void clear()
clear
in interface Map<String,String>
clear
in class AbstractMap<String,String>
public List<String> getHeader()
public void setHeader(List<String> header)
header
- the header to usepublic List<String> getFooter()
public void setFooter(List<String> footer)
footer
- the footer to useprotected void loadLayout(Reader in) throws IOException
in
- the reader to the properties file
IOException
- if an error occursprotected void saveLayout(Writer out) throws IOException
out
- the writer
IOException
- 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 null
IllegalArgumentException
- 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 null
null
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 find
true
if the array contains the object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |