com.liferay.portal.kernel.util
Class UnicodeProperties

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<java.lang.String,java.lang.String>
          extended by com.liferay.portal.kernel.util.UnicodeProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.String>

public class UnicodeProperties
extends java.util.HashMap<java.lang.String,java.lang.String>

View Source

This is a rewrite of java.util.Properties that is not synchronized and natively supports non-ASCII encodings. It can also be configured to be "safe", allowing the values to have new line characters. When stored to a given BufferedWriter, "safe" properties will replace all new line characters with a _SAFE_NEWLINE_CHARACTER_.

In its current form, this is not intended to replace java.util.Properties for reading properties flat files. This class is not thread-safe.

Author:
Alexander Chow
See Also:
Serialized Form

Constructor Summary
UnicodeProperties()
           
UnicodeProperties(boolean safe)
           
 
Method Summary
 java.lang.String getProperty(java.lang.String key)
           
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
           
protected  int getToStringLength()
           
 boolean isSafe()
           
 void load(java.lang.String props)
           
 java.lang.String put(java.lang.String key, java.lang.String value)
           
 java.lang.String remove(java.lang.Object key)
           
 java.lang.String setProperty(java.lang.String key, java.lang.String value)
           
 java.lang.String toString()
           
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, putAll, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

UnicodeProperties

public UnicodeProperties()

UnicodeProperties

public UnicodeProperties(boolean safe)
Method Detail

getProperty

public java.lang.String getProperty(java.lang.String key)

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultValue)

isSafe

public boolean isSafe()

load

public void load(java.lang.String props)
          throws java.io.IOException
Throws:
java.io.IOException

put

public java.lang.String put(java.lang.String key,
                            java.lang.String value)
Specified by:
put in interface java.util.Map<java.lang.String,java.lang.String>
Overrides:
put in class java.util.HashMap<java.lang.String,java.lang.String>

remove

public java.lang.String remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map<java.lang.String,java.lang.String>
Overrides:
remove in class java.util.HashMap<java.lang.String,java.lang.String>

setProperty

public java.lang.String setProperty(java.lang.String key,
                                    java.lang.String value)

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractMap<java.lang.String,java.lang.String>

getToStringLength

protected int getToStringLength()