org.apache.cayenne.wocompat
Class PropertyListSerialization

java.lang.Object
  extended by org.apache.cayenne.wocompat.PropertyListSerialization

public class PropertyListSerialization
extends java.lang.Object

A PropertyListSerialization is a utility class that reads and stores files in NeXT/Apple property list format. Unlike corresponding WebObjects class, PropertyListSerialization uses standard Java collections (lists and maps) to store property lists.

Author:
Andrei Adamchik

Constructor Summary
PropertyListSerialization()
           
 
Method Summary
protected static java.lang.String escapeString(java.lang.String str)
          Escapes all doublequotes and backslashes.
static java.lang.Object propertyListFromFile(java.io.File f)
          Reads a property list file.
static java.lang.Object propertyListFromStream(java.io.InputStream in)
          Reads a property list data from InputStream.
static void propertyListToFile(java.io.File f, java.lang.Object plist)
          Saves property list to file.
protected static java.lang.String quoteString(java.lang.String str)
          Returns a quoted String, with all the escapes preprocessed.
protected static void writeObject(java.lang.String offset, java.io.Writer out, java.lang.Object plist)
          Internal method to recursively write a property list object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyListSerialization

public PropertyListSerialization()
Method Detail

propertyListFromFile

public static java.lang.Object propertyListFromFile(java.io.File f)
                                             throws java.io.FileNotFoundException
Reads a property list file. Returns a property list object, that is normally a java.util.List or a java.util.Map, but can also be a String or a Number.

Throws:
java.io.FileNotFoundException

propertyListFromStream

public static java.lang.Object propertyListFromStream(java.io.InputStream in)
Reads a property list data from InputStream. Returns a property list o bject, that is normally a java.util.List or a java.util.Map, but can also be a String or a Number.


propertyListToFile

public static void propertyListToFile(java.io.File f,
                                      java.lang.Object plist)
Saves property list to file.


writeObject

protected static void writeObject(java.lang.String offset,
                                  java.io.Writer out,
                                  java.lang.Object plist)
                           throws java.io.IOException
Internal method to recursively write a property list object.

Throws:
java.io.IOException

escapeString

protected static java.lang.String escapeString(java.lang.String str)
Escapes all doublequotes and backslashes.


quoteString

protected static java.lang.String quoteString(java.lang.String str)
Returns a quoted String, with all the escapes preprocessed. May return an unquoted String if it contains no special characters. The rule for a non-special character is the following:
      c >= 'a' && c <= 'z'
      c >= 'A' && c <= 'Z'
      c >= '0' && c <= '9'
      c == '_'
      c == '$'
      c == ':'
      c == '.'
      c == '/'
 



Copyright © 2001-2006 Apache.org All Rights Reserved.