<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to Project Property List Library</title><link href="https://sourceforge.net/p/plist/" rel="alternate"/><link href="https://sourceforge.net/p/plist/feed.atom" rel="self"/><id>https://sourceforge.net/p/plist/</id><updated>2013-02-21T21:21:23.635000Z</updated><subtitle>Recent changes to Project Property List Library</subtitle><entry><title>#2 Does this library work with plists created with NSKeyedArchiver?</title><link href="https://sourceforge.net/p/plist/tickets/2/?limit=25#8c54" rel="alternate"/><published>2013-02-21T21:21:23.635000Z</published><updated>2013-02-21T21:21:23.635000Z</updated><author><name>Yørn de Jong</name><uri>https://sourceforge.net/u/byorn/</uri></author><id>https://sourceforge.nete780f459995171d2622685fcaa60aa6afd3a175b</id><summary type="html">&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;</summary></entry><entry><title>#2 Does this library work with plists created with NSKeyedArchiver?</title><link href="https://sourceforge.net/p/plist/tickets/2/?limit=25#11cb" rel="alternate"/><published>2013-02-21T21:17:15.196000Z</published><updated>2013-02-21T21:17:15.196000Z</updated><author><name>Strange1945</name><uri>https://sourceforge.net/u/fahadg123/</uri></author><id>https://sourceforge.net381934175c2992ce19e63f8f84d248c9560ffbc9</id><summary type="html">&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;</summary></entry><entry><title>#2 Does this library work with plists created with NSKeyedArchiver?</title><link href="https://sourceforge.net/p/plist/tickets/_discuss/thread/7b947767/" rel="alternate"/><published>2012-11-27T10:05:59.345000Z</published><updated>2012-11-27T10:05:59.345000Z</updated><author><name>Yørn de Jong</name><uri>https://sourceforge.net/u/byorn/</uri></author><id>https://sourceforge.netf8581f65312e7018307ddb545898704f40d99363</id><summary type="html">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.</summary></entry><entry><title>Does this library work with plists created with NSKeyedArchiver?</title><link href="https://sourceforge.net/p/plist/tickets/2/" rel="alternate"/><published>2012-11-27T07:50:26.467000Z</published><updated>2012-11-27T07:50:26.467000Z</updated><author><name>Strange1945</name><uri>https://sourceforge.net/u/fahadg123/</uri></author><id>https://sourceforge.neta46fb992c3876c33c9337b8dbefbed4dd9815315</id><summary type="html">If so, please can you show us an example of how to use it to open a plist file?</summary></entry><entry><title>#1 Edit NSData within an NSDictionary hierarchy</title><link href="https://sourceforge.net/p/plist/tickets/_discuss/thread/6a51acc9/" rel="alternate"/><published>2012-11-01T21:48:46.124000Z</published><updated>2012-11-01T21:48:46.124000Z</updated><author><name>Steven Darnell</name><uri>https://sourceforge.net/u/darnells/</uri></author><id>https://sourceforge.netbf0b6a1b904384a4159179bacfbaa131cd82cbc2</id><summary type="html">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.</summary></entry><entry><title>New commit</title><link href="https://sourceforge.net/p/plist/code/" rel="alternate"/><published>2012-10-31T11:07:11.028000Z</published><updated>2012-10-31T11:07:11.028000Z</updated><author><name>byorn</name><uri>https://sourceforge.net/u/userid-None/</uri></author><id>https://sourceforge.net6be77a48faeb395a49ff1e7a9ad9c121ca4270af</id><summary type="html">Released provisional release 2.1.0 alpha&lt;br&gt;&lt;a href="/p/plist/code/105/"&gt;View Changes&lt;/a&gt;</summary></entry><entry><title>#1 Edit NSData within an NSDictionary hierarchy</title><link href="https://sourceforge.net/p/plist/tickets/_discuss/thread/6a51acc9/" rel="alternate"/><published>2012-10-31T11:02:23.958000Z</published><updated>2012-10-31T11:02:23.958000Z</updated><author><name>Yørn de Jong</name><uri>https://sourceforge.net/u/byorn/</uri></author><id>https://sourceforge.net6ae8f4b0e368179f6db4ef88b15921fc99a3e643</id><summary type="html">
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.</summary></entry><entry><title>New commit</title><link href="https://sourceforge.net/p/plist/code/" rel="alternate"/><published>2012-10-31T10:54:40.658000Z</published><updated>2012-10-31T10:54:40.658000Z</updated><author><name>byorn</name><uri>https://sourceforge.net/u/userid-None/</uri></author><id>https://sourceforge.net5199259ca4a814e30c6ab79f9b38b649b245304c</id><summary type="html">Made NSObject#toMap and NSObject#toList less generic&lt;br&gt;&lt;a href="/p/plist/code/104/"&gt;View Changes&lt;/a&gt;</summary></entry><entry><title>New commit</title><link href="https://sourceforge.net/p/plist/code/" rel="alternate"/><published>2012-10-31T10:27:18.389000Z</published><updated>2012-10-31T10:27:18.389000Z</updated><author><name>byorn</name><uri>https://sourceforge.net/u/userid-None/</uri></author><id>https://sourceforge.netf3b032b36768ae71c8774a0881cca77db8bfbbaa</id><summary type="html">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;</summary></entry><entry><title>New commit</title><link href="https://sourceforge.net/p/plist/code/" rel="alternate"/><published>2012-10-30T21:29:30.868000Z</published><updated>2012-10-30T21:29:30.868000Z</updated><author><name>byorn</name><uri>https://sourceforge.net/u/userid-None/</uri></author><id>https://sourceforge.nete74fe9a5d279f9d5d6d39563a9be8c808e88c5fa</id><summary type="html">Added JUnit testcases&lt;br&gt;&lt;a href="/p/plist/code/102/"&gt;View Changes&lt;/a&gt;</summary></entry></feed>