<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Project Property List Library</title><link>https://sourceforge.net/p/plist/</link><description>Recent changes to Project Property List Library</description><atom:link href="https://sourceforge.net/p/plist/feed.rss" rel="self"/><language>en</language><lastBuildDate>Thu, 21 Feb 2013 21:21:23 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/plist/feed.rss" rel="self" type="application/rss+xml"/><item><title>#2 Does this library work with plists created with NSKeyedArchiver?</title><link>https://sourceforge.net/p/plist/tickets/2/?limit=25#8c54</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Hi, i'm sorry but 2.1 does not contain improvements with regard to NSKeyedArchiver. I am not very familiar with it and thus I don't feel like I will be able to write a good implementation for reading and/or writing them. When I have the time I will study some demo programs from Apple in order to gain a better understanding of the internal structure of those files.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Yørn de Jong</dc:creator><pubDate>Thu, 21 Feb 2013 21:21:23 -0000</pubDate><guid isPermaLink="false">https://sourceforge.nete780f459995171d2622685fcaa60aa6afd3a175b</guid></item><item><title>#2 Does this library work with plists created with NSKeyedArchiver?</title><link>https://sourceforge.net/p/plist/tickets/2/?limit=25#11cb</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks for the example Yorn de Jong! I see in the meanwhile you've prepared release 2.1. Does this mean support for NSKeyedArchiver is now implemented better in the new version?&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Strange1945</dc:creator><pubDate>Thu, 21 Feb 2013 21:17:15 -0000</pubDate><guid isPermaLink="false">https://sourceforge.net381934175c2992ce19e63f8f84d248c9560ffbc9</guid></item><item><title>#2 Does this library work with plists created with NSKeyedArchiver?</title><link>https://sourceforge.net/p/plist/tickets/_discuss/thread/7b947767/</link><description>Hi, thank you for your feedback. I used Apple's iSpend application to see what a file like this looks like. The Property List file generated by iSpend is an ASCII file with NSData objects for values. These NSData objects contain Binary Property Lists. Both of these can indeed be read using the Property List Library, but the way to do this is not entirely logical. I will include an easier way of doing this in a future release.

For now, just use this code; this code can read the Account Types in a typical iSpend application:

~~~~~~
:::java
File file = new File(getFile());
// Read the file created by NSKeyedArchiver
NSObject keyedDictionary = PropertyListParser.parse(file);
// Read the inner file with the key "AccountTypes"
NSObject accountTypesDictionary =
	PropertyListParser.parse(
		keyedDictionary.toMap().get("AccountTypes").toStream()
	);
// Read the list with Objects
List&lt;NSObject&gt; accountTypes =
	accountTypesDictionary.toMap().get("$objects").toList();
// Remove metadata at the beginning and end of the list
accountTypes = accountTypes.subList(2, accountTypes.size()-1);
// Output the account types
for(NSObject type : accountTypes)
	System.out.println(type);
~~~~~~

This solution does not allow you to "unarchive" as Java object. In order to do that I need to study these kinds of files more.

So please note that I haven't figured this file type out entirely, so this solution might need some tweaking. Please test your program before deploying it. Right now I'm pretty much consumed by my studies, I will look into this issue in more detail during/after the holidays. I will keep this ticket open until I have solved this.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Yørn de Jong</dc:creator><pubDate>Tue, 27 Nov 2012 10:05:59 -0000</pubDate><guid isPermaLink="false">https://sourceforge.netf8581f65312e7018307ddb545898704f40d99363</guid></item><item><title>Does this library work with plists created with NSKeyedArchiver?</title><link>https://sourceforge.net/p/plist/tickets/2/</link><description>If so, please can you show us an example of how to use it to open a plist file?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Strange1945</dc:creator><pubDate>Tue, 27 Nov 2012 07:50:26 -0000</pubDate><guid isPermaLink="false">https://sourceforge.neta46fb992c3876c33c9337b8dbefbed4dd9815315</guid></item><item><title>#1 Edit NSData within an NSDictionary hierarchy</title><link>https://sourceforge.net/p/plist/tickets/_discuss/thread/6a51acc9/</link><description>Thanks for the suggestion! The 2.0.0 version of this workflow works for me. Is it possible for this workflow to be documented on the Howto page? If so, I suggest using this ticket to track the documentation issue.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Steven Darnell</dc:creator><pubDate>Thu, 01 Nov 2012 21:48:46 -0000</pubDate><guid isPermaLink="false">https://sourceforge.netbf0b6a1b904384a4159179bacfbaa131cd82cbc2</guid></item><item><title>New commit</title><link>https://sourceforge.net/p/plist/code/</link><description>Released provisional release 2.1.0 alpha&lt;br&gt;&lt;a href="/p/plist/code/105/"&gt;View Changes&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">byorn</dc:creator><pubDate>Wed, 31 Oct 2012 11:07:11 -0000</pubDate><guid isPermaLink="false">https://sourceforge.net6be77a48faeb395a49ff1e7a9ad9c121ca4270af</guid></item><item><title>#1 Edit NSData within an NSDictionary hierarchy</title><link>https://sourceforge.net/p/plist/tickets/_discuss/thread/6a51acc9/</link><description>
Hi, thank you for your feedback!

What you want to accomplish is to edit a Property List file several NSDictionaries deep.
This Property List Library uses immutable objects which means the objects cannot be edited (they have a steady state) but they can be replaced by new objects.
This pattern is also used by Java itself with it's primitive types (Strings, Integers, etc.).

The way to do what you want with 2.0.0 is by extracting the dictionaries one by one,
make the modification and then reassemble them. This can be done as follows:

~~~~~~
:::java
File file = getFile();
// Extract
SortedMap&lt;String,NSObject&gt; root = PropertyListParser.parse(file).toMap();
SortedMap&lt;String,NSObject&gt; version254 = root.get("Version 2.5.4").toMap();
SortedMap&lt;String,NSObject&gt; icAdded = version254.get("ic-added").toMap();
SortedMap&lt;String,NSObject&gt; checkForUpdates = icAdded.get("CheckForUpdates").toMap();

// Reassembly
checkForUpdates.put("ic-data", new NSData(new byte[]{1}));
icAdded.put("CheckForUpdates", new NSDictionary(checkForUpdates));
version254.put("ic-added", new NSDictionary(icAdded));
root.put("Version 2.5.4", new NSDictionary(version254));
PropertyListWriter.write(new NSDictionary(root), file);
~~~~~~

If you think that this is too much of a hassle,
the version in SVN supports extracting and reassembling Property List files as standard Java objects.
You can call NSObject#toMapObject() to convert it to a read-write TreeMap,
and call NSObject#fromObject(Object) to convert it back to an NSDictionary.

Be adviced that I did not test the SVN version that well, though.
For your convenience I uploaded the Javadoc for revision #105 (which I will call 2.1.0 alpha) here:
http://plist.sourceforge.net/lib/doc/2.1.0a/

Be sure to let me know if you have any more questions or encounter problems with either the proposed solution or the SVN version.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Yørn de Jong</dc:creator><pubDate>Wed, 31 Oct 2012 11:02:23 -0000</pubDate><guid isPermaLink="false">https://sourceforge.net6ae8f4b0e368179f6db4ef88b15921fc99a3e643</guid></item><item><title>New commit</title><link>https://sourceforge.net/p/plist/code/</link><description>Made NSObject#toMap and NSObject#toList less generic&lt;br&gt;&lt;a href="/p/plist/code/104/"&gt;View Changes&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">byorn</dc:creator><pubDate>Wed, 31 Oct 2012 10:54:40 -0000</pubDate><guid isPermaLink="false">https://sourceforge.net5199259ca4a814e30c6ab79f9b38b649b245304c</guid></item><item><title>New commit</title><link>https://sourceforge.net/p/plist/code/</link><description>Made NSObject#toBytes() abstract, every extending object now has its own implementation.&lt;br&gt;&lt;a href="/p/plist/code/103/"&gt;View Changes&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">byorn</dc:creator><pubDate>Wed, 31 Oct 2012 10:27:18 -0000</pubDate><guid isPermaLink="false">https://sourceforge.netf3b032b36768ae71c8774a0881cca77db8bfbbaa</guid></item><item><title>New commit</title><link>https://sourceforge.net/p/plist/code/</link><description>Added JUnit testcases&lt;br&gt;&lt;a href="/p/plist/code/102/"&gt;View Changes&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">byorn</dc:creator><pubDate>Tue, 30 Oct 2012 21:29:30 -0000</pubDate><guid isPermaLink="false">https://sourceforge.nete74fe9a5d279f9d5d6d39563a9be8c808e88c5fa</guid></item></channel></rss>