|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable<Object,Object>
java.util.Properties
org.nuiton.io.SortedProperties
public class SortedProperties
Extend Properties to allow alphabetical order. Encoding could also
be defined but you must use this class only with Java 1.6.
| Field Summary | |
|---|---|
protected String |
defaultEncoding
l'encoding par defaut a utiliser pour lire et ecrire le properties. |
static String |
ENCODING_ASCII
|
static String |
ENCODING_DEFAULT
|
static String |
ENCODING_LATIN1
|
protected char[] |
hexDigit
|
protected boolean |
removeHeader
un drapeau pour savoir s'il faut enlever l'entete generere |
protected boolean |
unicodeLower
A flag to write unicode using the a lower letter. |
| Fields inherited from class java.util.Properties |
|---|
defaults |
| Constructor Summary | |
|---|---|
SortedProperties()
|
|
SortedProperties(Properties defaults)
|
|
SortedProperties(String defaultEncoding)
|
|
SortedProperties(String defaultEncoding,
boolean removeHeader)
|
|
SortedProperties(String defaultEncoding,
boolean removeHeader,
boolean unicodeLower)
|
|
| Method Summary | |
|---|---|
Enumeration<Object> |
keys()
|
SortedProperties |
load(File src)
Load all properties from given src file using defined defaultEncoding. |
SortedProperties |
load(File src,
String encoding)
Load Properties from src file using given defaultEncoding. |
protected String |
saveConvert(String theString,
boolean escapeSpace,
boolean escapeUnicode)
|
void |
store(File dst)
Save properties in given dst file using defined defaultEncoding. |
void |
store(File dst,
String encoding)
Store Properties in output file using given defaultEncoding. |
void |
store(OutputStream dst)
Save properties in given stream file. |
void |
store(OutputStream out,
String comments)
|
void |
store(Writer writer,
String comments)
|
protected void |
store0(BufferedWriter bw,
String comments,
boolean escUnicode)
|
protected void |
storeEncode(OutputStream stream,
String encoding)
If encoding is not the default Properties one, we will use a writer to use this custom encoding. |
protected char |
toHex(int nibble)
Convert a nibble to a hex character |
void |
writeComments(BufferedWriter bw,
String comments)
|
| Methods inherited from class java.util.Properties |
|---|
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, storeToXML, storeToXML, stringPropertyNames |
| Methods inherited from class java.util.Hashtable |
|---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, rehash, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String ENCODING_DEFAULT
public static final String ENCODING_LATIN1
public static final String ENCODING_ASCII
protected String defaultEncoding
protected boolean removeHeader
protected final boolean unicodeLower
é instead of é.
protected final char[] hexDigit
| Constructor Detail |
|---|
public SortedProperties()
public SortedProperties(String defaultEncoding)
public SortedProperties(String defaultEncoding,
boolean removeHeader)
public SortedProperties(String defaultEncoding,
boolean removeHeader,
boolean unicodeLower)
public SortedProperties(Properties defaults)
| Method Detail |
|---|
public Enumeration<Object> keys()
keys in class Hashtable<Object,Object>
public SortedProperties load(File src)
throws IOException
src file using defined defaultEncoding.
src - source file
IOException - if any io pbload(File, String)
public SortedProperties load(File src,
String encoding)
throws IOException
src file using given defaultEncoding.
If this encoding is different from default ones
ENCODING_DEFAULT, ENCODING_LATIN1
and ENCODING_ASCII. A specific Reader will
be used to read the file.
src - File where Properties will be loadedencoding - Encoding to use
IOException - for any file errors
public void store(File dst)
throws IOException
dst file using defined defaultEncoding.
dst - output file
IOException - if any io pbstore(File, String)
public void store(File dst,
String encoding)
throws IOException
output file using given defaultEncoding.
If this encoding is different from default ones
ENCODING_DEFAULT, ENCODING_LATIN1
and ENCODING_ASCII, a specific Writer will
be used to save the file. Otherwise the default Properties behavior
will escape unicode chars with \uxxxx.
dst - File to save Propertiesencoding - Encoding to use
IOException - for any file errors
protected void storeEncode(OutputStream stream,
String encoding)
throws IOException
store(Writer, String) method is used otherwise the
default encoding 8859_1 must be used as superclass define it in
store(OutputStream, String).
Encoding ENCODING_DEFAULT,
ENCODING_LATIN1 and ENCODING_ASCII
are considered as default Properties one, so the old method will be use
escaping unicode chars like \uxxxx.
stream - OutputStream to save inencoding - Encoding to use
IOException - For any file errors
public void store(OutputStream dst)
throws IOException
stream file. defaultEncoding defined
will be ignored to store the properties file. The default encoding is the
basic Properties one (Latin1 ISO), unicode chars will be escaped
like basic store(OutputStream, String) method.
dst - output file
IOException - if any io pb
public void store(OutputStream out,
String comments)
throws IOException
store in class PropertiesIOException
public void store(Writer writer,
String comments)
throws IOException
store in class PropertiesIOException
protected void store0(BufferedWriter bw,
String comments,
boolean escUnicode)
throws IOException
IOException
protected String saveConvert(String theString,
boolean escapeSpace,
boolean escapeUnicode)
public void writeComments(BufferedWriter bw,
String comments)
throws IOException
IOExceptionprotected char toHex(int nibble)
nibble - the nibble to convert.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||