aQute.lib.utf8properties
Class UTF8Properties
java.lang.Object
java.util.Dictionary<K,V>
java.util.Hashtable<Object,Object>
java.util.Properties
aQute.lib.utf8properties.UTF8Properties
- All Implemented Interfaces:
- Serializable, Cloneable, Map<Object,Object>
public class UTF8Properties
- extends Properties
Properties were by default read as ISO-8859-1 characters. However, in the
last 10 years most builds use UTF-8. Since this is in general a global
setting, it is very awkward to use ISO-8859-1. In general, it is not often a
problem since most of Java is written with the basic ASCII encoding. However,
we want to do this right. So in bnd we generally use this UTF-8 Properties
class. This class always writes UTF-8. However, it will try to read UTF-8
first. If this fails, it will try ISO-8859-1, and the last attempt is the
platform default.
An additional problem is backslash encoding. When reading properties, the
Properties class skips backslashes that have no correct next character. This
is not a real problem if it was not for bndtools where it turned out to be
real tricky to get the UI to understand this since text widgets read from the
properties (backslash removed) while the main text is just, well, the main
text and has the backslash present. Since we strife to fidelity, we actually
fixup the
This class can (and probably should) be used anywhere a Properties class is
used.
- See Also:
- Serialized Form
| Methods inherited from class java.util.Properties |
getProperty, getProperty, list, list, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML, stringPropertyNames |
| Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
UTF8Properties
public UTF8Properties(Properties p)
UTF8Properties
public UTF8Properties()
load
public void load(InputStream in)
throws IOException
- Overrides:
load in class Properties
- Throws:
IOException
load
public void load(Reader r)
throws IOException
- Overrides:
load in class Properties
- Throws:
IOException
store
public void store(OutputStream out,
String msg)
throws IOException
- Overrides:
store in class Properties
- Throws:
IOException
Copyright © 2014 aQute SARL. All rights reserved.