|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<String,String>
util.LinkedProperties
public class LinkedProperties
Linked properties retain the order of key insertion. This in particular applies to reading the properties from a stream. Additionally, comments are kept as special properties.
| Nested Class Summary | |
|---|---|
static class |
LinkedProperties.Test
Test class. |
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
| Field Summary | |
|---|---|
static String |
COMMENT
Commants are entered with this key, postfixed with a running number. |
private int |
commentcount
Current comment count. |
private static String |
SEPARATORS
A string containing possible key-value separators. |
| Constructor Summary | |
|---|---|
LinkedProperties()
Supported constructor as in Properties. |
|
LinkedProperties(Map<String,String> org)
Supported constructor as in Properties, except for the fact
that we directly load the map into our internal map via the
LinkedHashMap.LinkedHashMap(Map) constructor. |
|
| Method Summary | |
|---|---|
void |
addComment(String rem)
Adds a comment to the end of the properties. |
private String |
convertUnicode(String src)
Converts characters in a string less than 20 or above e7 to unicode. |
void |
insertComment(int index,
String comment)
Inserts a comment at the given position. |
static boolean |
isComment(String key)
Returns true if the key represents a comment. |
int |
load(InputStream in)
Loads the property, keeps comments. |
int |
load(InputStream in,
boolean keeprem)
Loads the properties from the stream. |
static LinkedProperties |
loadFromFile(File loc)
Loads linked properties from a file. |
static LinkedProperties |
loadFromURL(URL loc)
Loads linked properties from an url. |
static boolean |
saveToFile(File loc,
Map<String,String> prop)
Saves linked properties to a file. |
private int |
scanCommentCount()
Traverses all keys to find the current number of comments in the map. |
void |
store(OutputStream into)
Write the properties with comments. |
void |
store(OutputStream into,
boolean writerem)
Writes the properties and possible comments to the stream. |
| Methods inherited from class java.util.LinkedHashMap |
|---|
clear, containsValue, get, removeEldestEntry |
| Methods inherited from class java.util.HashMap |
|---|
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
| Field Detail |
|---|
public static final String COMMENT
private static final String SEPARATORS
private int commentcount
| Constructor Detail |
|---|
public LinkedProperties()
Properties.
public LinkedProperties(Map<String,String> org)
Properties, except for the fact
that we directly load the map into our internal map via the
LinkedHashMap.LinkedHashMap(Map) constructor.
| Method Detail |
|---|
public int load(InputStream in)
throws IOException
IOException
public int load(InputStream in,
boolean keeprem)
throws IOException
Properties.load(java.io.Reader).The input stream is not closed.
IOException
public void store(OutputStream into)
throws IOException
IOException
public void store(OutputStream into,
boolean writerem)
throws IOException
The output stream is not closed.
IOExceptionpublic static boolean isComment(String key)
public void insertComment(int index,
String comment)
public void addComment(String rem)
private int scanCommentCount()
public static LinkedProperties loadFromURL(URL loc)
PropertyLoader as it requires jdk 1.4 for compile. It does not
throw an exception, rather returns null if the properties cannot be
loaded.
public static LinkedProperties loadFromFile(File loc)
PropertyLoader as it requires jdk 1.4 for compile. It does not
throw an exception, rather returns null if the properties cannot be
loaded.
public static boolean saveToFile(File loc,
Map<String,String> prop)
PropertyLoader as it requires jdk 1.4 for compile. It does not
throw an exception, rather returns null if the properties cannot be
loaded.
private String convertUnicode(String src)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||