Class PropertyListSerialization


  • public final class PropertyListSerialization
    extends java.lang.Object
    Static class that provides methods to serialize a Map to a Cocoa XML Property List. Does not currently support date or data elements.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void serialize​(java.util.Map propertyList, java.util.List comments, java.io.File file)
      Serializes a property list into a Cocoa XML Property List document.
      private static void serializeBoolean​(java.lang.Boolean val, org.xml.sax.ContentHandler handler)
      Serialize a Boolean as a true or false element.
      private static void serializeElement​(java.lang.String tag, java.lang.String content, org.xml.sax.ContentHandler handler)
      Creates an element with the specified tag name and character content.
      private static void serializeInteger​(java.lang.Number integer, org.xml.sax.ContentHandler handler)
      Serialize a Number as an integer element.
      private static void serializeList​(java.util.List list, org.xml.sax.ContentHandler handler)
      Serialize a list as an array element.
      private static void serializeMap​(java.util.Map map, org.xml.sax.ContentHandler handler)
      Serialize a map as a dict element.
      private static void serializeObject​(java.lang.Object obj, org.xml.sax.ContentHandler handler)
      Serialize an object using the best available element.
      private static void serializeReal​(java.lang.Number real, org.xml.sax.ContentHandler handler)
      Serialize a Number as a real element.
      private static void serializeString​(java.lang.String val, org.xml.sax.ContentHandler handler)
      Serialize a string as a string element.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PropertyListSerialization

        private PropertyListSerialization()
        Private constructor.
    • Method Detail

      • serialize

        public static void serialize​(java.util.Map propertyList,
                                     java.util.List comments,
                                     java.io.File file)
                              throws java.io.IOException,
                                     org.xml.sax.SAXException,
                                     javax.xml.transform.TransformerConfigurationException
        Serializes a property list into a Cocoa XML Property List document.
        Parameters:
        propertyList - property list.
        file - destination.
        comments - comments to insert into document.
        Throws:
        org.xml.sax.SAXException - if exception during serialization.
        javax.xml.transform.TransformerConfigurationException - if exception creating serializer.
        java.io.IOException
      • serializeMap

        private static void serializeMap​(java.util.Map map,
                                         org.xml.sax.ContentHandler handler)
                                  throws org.xml.sax.SAXException
        Serialize a map as a dict element.
        Parameters:
        map - map to serialize.
        handler - destination of serialization events.
        Throws:
        org.xml.sax.SAXException - if exception during serialization.
      • serializeList

        private static void serializeList​(java.util.List list,
                                          org.xml.sax.ContentHandler handler)
                                   throws org.xml.sax.SAXException
        Serialize a list as an array element.
        Parameters:
        list - list to serialize.
        handler - destination of serialization events.
        Throws:
        org.xml.sax.SAXException - if exception during serialization.
      • serializeElement

        private static void serializeElement​(java.lang.String tag,
                                             java.lang.String content,
                                             org.xml.sax.ContentHandler handler)
                                      throws org.xml.sax.SAXException
        Creates an element with the specified tag name and character content.
        Parameters:
        tag - tag name.
        content - character content.
        handler - destination of serialization events.
        Throws:
        org.xml.sax.SAXException - if exception during serialization.
      • serializeInteger

        private static void serializeInteger​(java.lang.Number integer,
                                             org.xml.sax.ContentHandler handler)
                                      throws org.xml.sax.SAXException
        Serialize a Number as an integer element.
        Parameters:
        integer - number to serialize.
        handler - destination of serialization events.
        Throws:
        org.xml.sax.SAXException - if exception during serialization.
      • serializeReal

        private static void serializeReal​(java.lang.Number real,
                                          org.xml.sax.ContentHandler handler)
                                   throws org.xml.sax.SAXException
        Serialize a Number as a real element.
        Parameters:
        real - number to serialize.
        handler - destination of serialization events.
        Throws:
        org.xml.sax.SAXException - if exception during serialization.
      • serializeBoolean

        private static void serializeBoolean​(java.lang.Boolean val,
                                             org.xml.sax.ContentHandler handler)
                                      throws org.xml.sax.SAXException
        Serialize a Boolean as a true or false element.
        Parameters:
        val - boolean to serialize.
        handler - destination of serialization events.
        Throws:
        org.xml.sax.SAXException - if exception during serialization.
      • serializeString

        private static void serializeString​(java.lang.String val,
                                            org.xml.sax.ContentHandler handler)
                                     throws org.xml.sax.SAXException
        Serialize a string as a string element.
        Parameters:
        val - string to serialize.
        handler - destination of serialization events.
        Throws:
        org.xml.sax.SAXException - if exception during serialization.
      • serializeObject

        private static void serializeObject​(java.lang.Object obj,
                                            org.xml.sax.ContentHandler handler)
                                     throws org.xml.sax.SAXException
        Serialize an object using the best available element.
        Parameters:
        obj - object to serialize.
        handler - destination of serialization events.
        Throws:
        org.xml.sax.SAXException - if exception during serialization.