org.apache.cayenne.wocompat
Class PropertyListSerialization

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

public class PropertyListSerialization
extends 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.


Constructor Summary
PropertyListSerialization()
           
 
Method Summary
protected static String escapeString(String str)
          Escapes all doublequotes and backslashes.
static Object propertyListFromFile(File f)
          Reads a property list file.
static Object propertyListFromFile(File f, PlistDataStructureFactory factory)
          Reads a property list file.
static Object propertyListFromStream(InputStream in)
          Reads a property list data from InputStream.
static Object propertyListFromStream(InputStream in, PlistDataStructureFactory factory)
          Reads a property list data from InputStream.
static void propertyListToFile(File f, Object plist)
          Saves property list to file.
static void propertyListToStream(OutputStream os, Object plist)
          Saves property list to file.
protected static String quoteString(String str)
          Returns a quoted String, with all the escapes preprocessed.
protected static void writeObject(String offset, Writer out, 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 Object propertyListFromFile(File f)
                                   throws 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:
FileNotFoundException

propertyListFromFile

public static Object propertyListFromFile(File f,
                                          PlistDataStructureFactory factory)
                                   throws 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:
FileNotFoundException

propertyListFromStream

public static Object propertyListFromStream(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.


propertyListFromStream

public static Object propertyListFromStream(InputStream in,
                                            PlistDataStructureFactory factory)
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(File f,
                                      Object plist)
Saves property list to file.


propertyListToStream

public static void propertyListToStream(OutputStream os,
                                        Object plist)
Saves property list to file.


writeObject

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

Throws:
IOException

escapeString

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


quoteString

protected static String quoteString(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-2011 Apache Cayenne. All Rights Reserved.