|
WebObjects 5.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.webobjects.foundation.NSPropertyListSerialization
This class provides static methods that convert between property lists and their string representations, which can be either strings or NSData objects. A property list is a structure that represents organized data. It can be built from a combination of NSArray, NSDictionary, String, and NSData objects.
The string representation can be in XML or the ASCII plist format.
To distinguish between the two formats, the parser that converts
strings to property lists finds out whether the string starts with
<?xml
. A discussion of the ASCII plist format,
A Primer on ASCII Property Lists, is available in the Mac
OS X section of the Apple Developer Connection website. A discussion
of XML property lists, Property List Services, is also
available in the same area of the Apple Developer Connection website.
booleanForString
and intForString
.The NSPropertyListSerialization class cannot be instantiated.
booleanForString(java.lang.String)
,
intForString(java.lang.String)
Constructor Summary | |
NSPropertyListSerialization()
|
Method Summary | |
static NSArray |
arrayForString(String string)
Parses the property list representation string and
returns the resulting property list as an NSArray. |
static boolean |
booleanForString(String string)
Parses a given string for boolean value according to the following table: |
static NSData |
dataFromPropertyList(Object object)
Deprecated. Use dataFromPropertyList(Object object, String encoding) instead. |
static NSData |
dataFromPropertyList(Object object,
String encoding)
Converts the property list object into a string using a character encoding and
returns it as an NSData object. |
static NSDictionary |
dictionaryForString(String string)
Parses the property list representation string and
returns the resulting property list as an NSDictionary. |
static int |
intForString(String string)
Parses a given string and returns the corresponding integer value. |
static Object |
propertyListFromData(NSData data)
Deprecated. Use propertyListFromData(NSData data, String encoding) |
static Object |
propertyListFromData(NSData data,
String encoding)
Converts an NSData into a property list using a character encoding and returns it. |
static Object |
propertyListFromString(String string)
Converts a string into a property list and returns it. |
static String |
stringFromPropertyList(Object plist)
Converts a property list object into a string and returns it. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NSPropertyListSerialization()
Method Detail |
public static NSArray arrayForString(String string)
string
and
returns the resulting property list as an NSArray.string
- input property list representation stringClassCastException
- if the root object is not an arraydictionaryForString(String)
public static boolean booleanForString(String string)
String | Result | |
---|---|---|
"YES" |
true |
|
"true" |
true |
|
any other value | false |
The tests for "YES" and "true" are case insensitive.
string
- the string to be parsed for boolean valuepublic static NSData dataFromPropertyList(Object object)
object
into a string and
returns it as an NSData object. This method uses the platform's
default character encoding to convert the result string to byte.object
- property list objectobject
converted to an NSDatapropertyListFromData(NSData, java.lang.String)
public static NSData dataFromPropertyList(Object object, String encoding)
object
into a string using a character encoding and
returns it as an NSData object.object
- the property list object to convertencoding
- encoding used to convert the
characters in the result string to byteobject
converted to an NSDatapropertyListFromData(NSData, java.lang.String)
public static NSDictionary dictionaryForString(String string)
string
and
returns the resulting property list as an NSDictionary.string
- property list representated as a stringstring
as an NSDictionaryClassCastException
- if the root object is not a dictionaryarrayForString(String)
public static int intForString(String string)
string
- the string to be parsed for integer valuestring
; 0
if it is
null
public static Object propertyListFromData(NSData data)
This method uses the platform's default character encoding
to convert the bytes in data
byte array to characters
in a string representation.
data
- the byte array to be converted to a property listdata
as a property listdataFromPropertyList(Object, java.lang.String)
public static Object propertyListFromData(NSData data, String encoding)
data
- the byte array to be converted to a property listencoding
- encoding to use to convert the bytes in the data
byte array to characters in a string representationdata
as a property listdataFromPropertyList(Object, java.lang.String)
public static Object propertyListFromString(String string)
string
- the string to convert to a property liststring
as a property liststringFromPropertyList(java.lang.Object)
public static String stringFromPropertyList(Object plist)
plist
- the property list to convertplist
as a stringpropertyListFromString(java.lang.String)
|
Last updated Fri Feb 21 13:15:00 PST 2003. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |