org.apache.commons.configuration.plist

Class PropertyListConfiguration

public class PropertyListConfiguration extends AbstractHierarchicalFileConfiguration

NeXT / OpenStep style configuration. (http://developer.apple.com/documentation/Cocoa/Conceptual/PropertyLists/Concepts/OldStylePListsConcept.html)

Example:

 {
     foo = "bar";

     array = ( value1, value2, value3 );

     data = <4f3e0145ab>;

     nested =
     {
         key1 = value1;
         key2 = value;
         nested =
         {
             foo = bar
         }
     }
 }
 

Since: 1.2

Version: $Revision: 492216 $, $Date: 2007-01-03 17:51:24 +0100 (Mi, 03 Jan 2007) $

Author: Emmanuel Bourg

Field Summary
static intINDENT_SIZE
Size of the indentation for the generated file.
static longserialVersionUID
The serial version UID.
Constructor Summary
PropertyListConfiguration()
Creates an empty PropertyListConfiguration object which can be used to synthesize a new plist file by adding values and then saving().
PropertyListConfiguration(HierarchicalConfiguration c)
Creates a new instance of PropertyListConfiguration and copies the content of the specified configuration into this object.
PropertyListConfiguration(String fileName)
Creates and loads the property list from the specified file.
PropertyListConfiguration(File file)
Creates and loads the property list from the specified file.
PropertyListConfiguration(URL url)
Creates and loads the property list from the specified URL.
Method Summary
voidload(Reader in)
voidprintNode(PrintWriter out, int indentLevel, Node node)
Append a node to the writer, indented according to a specific level.
voidprintValue(PrintWriter out, int indentLevel, Object value)
Append a value to the writer, indented according to a specific level.
StringquoteString(String s)
Quote the specified string if necessary, that's if the string contains:
  • a space character (' ', '\t', '\r', '\n')
  • a quote '"'
  • special characters in plist files ('(', ')', '{', '}', '=', ';', ',')
Quotes within the string are escaped.
voidsave(Writer out)

Field Detail

INDENT_SIZE

private static final int INDENT_SIZE
Size of the indentation for the generated file.

serialVersionUID

private static final long serialVersionUID
The serial version UID.

Constructor Detail

PropertyListConfiguration

public PropertyListConfiguration()
Creates an empty PropertyListConfiguration object which can be used to synthesize a new plist file by adding values and then saving().

PropertyListConfiguration

public PropertyListConfiguration(HierarchicalConfiguration c)
Creates a new instance of PropertyListConfiguration and copies the content of the specified configuration into this object.

Parameters: c the configuration to copy

Since: 1.4

PropertyListConfiguration

public PropertyListConfiguration(String fileName)
Creates and loads the property list from the specified file.

Parameters: fileName The name of the plist file to load.

Throws: ConfigurationException Error while loading the plist file

PropertyListConfiguration

public PropertyListConfiguration(File file)
Creates and loads the property list from the specified file.

Parameters: file The plist file to load.

Throws: ConfigurationException Error while loading the plist file

PropertyListConfiguration

public PropertyListConfiguration(URL url)
Creates and loads the property list from the specified URL.

Parameters: url The location of the plist file to load.

Throws: ConfigurationException Error while loading the plist file

Method Detail

load

public void load(Reader in)

printNode

private void printNode(PrintWriter out, int indentLevel, Node node)
Append a node to the writer, indented according to a specific level.

printValue

private void printValue(PrintWriter out, int indentLevel, Object value)
Append a value to the writer, indented according to a specific level.

quoteString

String quoteString(String s)
Quote the specified string if necessary, that's if the string contains: Quotes within the string are escaped.

Examples:

save

public void save(Writer out)