{"id":22281108,"url":"https://github.com/3breadt/dd-plist","last_synced_at":"2025-05-15T01:06:15.292Z","repository":{"id":28631345,"uuid":"32150220","full_name":"3breadt/dd-plist","owner":"3breadt","description":"A java library providing support for ASCII, XML and binary property lists.","archived":false,"fork":false,"pushed_at":"2024-08-10T11:53:48.000Z","size":1221,"stargazers_count":267,"open_issues_count":1,"forks_count":99,"subscribers_count":37,"default_branch":"master","last_synced_at":"2025-04-10T10:04:52.869Z","etag":null,"topics":["ascii","cocoa","ios","java","java-library","parse","plist","xml"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/3breadt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-03-13T10:36:51.000Z","updated_at":"2025-04-02T16:55:51.000Z","dependencies_parsed_at":"2025-01-14T23:46:04.452Z","dependency_job_id":null,"html_url":"https://github.com/3breadt/dd-plist","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3breadt%2Fdd-plist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3breadt%2Fdd-plist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3breadt%2Fdd-plist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3breadt%2Fdd-plist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3breadt","download_url":"https://codeload.github.com/3breadt/dd-plist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254254040,"owners_count":22039792,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ascii","cocoa","ios","java","java-library","parse","plist","xml"],"created_at":"2024-12-03T16:14:25.687Z","updated_at":"2025-05-15T01:06:10.275Z","avatar_url":"https://github.com/3breadt.png","language":"Java","readme":"# com.dd.plist - A Java library for working with property lists\n\n[![Build Status](https://app.travis-ci.com/3breadt/dd-plist.svg?branch=master)](https://app.travis-ci.com/3breadt/dd-plist)\n\nThis library enables your Java application to handle property lists of various formats. It is licensed under the terms of the MIT license.\n\nProperty lists are files used to store user settings and serialized objects.\nThey originate from the NeXSTEP programming environment and are now a basic part of the Cocoa framework (OS X and iOS) as well as the GNUstep framework.\n\n## Features\n\n * Read / write property lists from / to files, streams or byte arrays\n * Convert between property list formats\n * Property list contents are provided as objects from the NeXTSTEP environment (NSDictionary, NSArray, NSString, etc.)\n * Serialize native java data structures to property list objects\n * Deserialize from property list objects to native java data structures\n\n## Supported formats\n\n * Cocoa XML\n * Cocoa Binary (v0)\n * Cocoa / NeXSTSTEP / GNUstep ASCII\n\n## Maven support\n\nIf you use Maven and want to include the library into your project you can use the following dependency.\n\n    \u003cdependency\u003e\n      \u003cgroupId\u003ecom.googlecode.plist\u003c/groupId\u003e\n      \u003cartifactId\u003edd-plist\u003c/artifactId\u003e\n      \u003cversion\u003e1.28\u003c/version\u003e\n    \u003c/dependency\u003e\n\n## Help\n\nThe API documentation is included in the download but can also be browsed online: [JavaDoc for com.dd.plist](https://3breadt.github.io/dd-plist/).\n\nIf you have further questions please post them on the [GitHub issue tracker](https://github.com/3breadt/dd-plist/issues) or in the Discussion forum plist-discuss on [Google Groups](http://groups.google.com/group/plist-discuss).\n\n## Usage examples\n\n### Reading\n\nParsing can be done with the PropertyListParser class. You can feed the `PropertyListParser` with a `File`, an `InputStream` or a `byte` array.\nThe `parse` method of the `PropertyListParser` will parse the input and give you a `NSObject` as result. Generally this is a `NSDictionary` but it can also be a `NSArray`.\n\n_Note: Property lists created by `NSKeyedArchiver` are not yet supported_\n\nYou can then navigate the contents of the property lists using the various classes extending `NSObject`. These are modeled in such a way as to closely resemble the respective Cocoa classes.\n\nYou can also directly convert the contained `NSObject` objects into native Java objects with the `NSObject.toJavaObject()` method. Using this method you can avoid working with `NSObject` instances altogether.\n\n### Writing\n\nYou can create your own property list using the various constructors of the different `NSObject` classes. Or you can wrap existing native Java structures with the method `NSObject.wrap(Object o)`. Just make sure that the root object of the property list is either a `NSDictionary` (can be created from objects of the type `Map\u003cString, Object\u003e`) or a `NSArray` (can be created from object arrays).\n\nFor building an XML property list you can then call the `toXMLPropertyList` method on the root object of your property list. It will give you a UTF-8 `String` containing the property list in XML format.\n\nIf you want to have the property list in binary format use the `BinaryPropertyListWriter` class. It can write the binary property list directly to a file or to an `OutputStream`.\n\nWhen you directly want to save your property list to a file, you can also use the `saveAsXML` or `saveAsBinary` methods of the `PropertyListParser` class.\n\n### Converting\n\nFor converting a file into another format there exist convenience methods in the `PropertyListParser` class: `convertToXML`, `convertToBinary`,  `convertToASCII` and `convertToGnuStepASCII`.\n\n## Code snippets\n\n### Reading\n\n    try {\n      File file = new File(\"Info.plist\");\n      NSDictionary rootDict = (NSDictionary)PropertyListParser.parse(file);\n      String name = rootDict.objectForKey(\"Name\").toString();\n      NSObject[] parameters = ((NSArray)rootDict.objectForKey(\"Parameters\")).getArray();\n      for(NSObject param:parameters) {\n        if(param.getClass().equals(NSNumber.class)) {\n          NSNumber num = (NSNumber)param;\n          switch(num.type()) {\n            case NSNumber.BOOLEAN : {\n              boolean bool = num.boolValue();\n              //...\n              break;\n            }\n            case NSNumber.INTEGER : {\n              long l = num.longValue();\n              //or int i = num.intValue();\n              //...\n              break;\n            }\n            case NSNumber.REAL : {\n              double d = num.doubleValue();\n              //...\n              break;\n            }\n          }\n        }\n        // else...\n      }\n    } catch(Exception ex) {\n      ex.printStackTrace();\n    }\n\n\n#### On Android\n\nPut your property list files into the project folder _res/raw_ to mark them as resource files. Then you can create an `InputStream` for that resource and pass it to the `PropertyListParser`.\n\nIn this example your property list file is called _properties.plist_.\n\n    try {\n      InputStream is = getResources().openRawResource(R.raw.properties);\n      NSDictionary rootDict = (NSDictionary)PropertyListParser.parse(is);\n      //Continue parsing...\n    } catch(Exception ex) {\n      //Handle exceptions...\n    }\n\n### Writing\n\n    //Creating the root object\n    NSDictionary root = new NSDictionary();\n\n    //Creation of an array of the length 2\n    NSArray people = new NSArray(2);\n\n    //Creation of the first object to be stored in the array\n    NSDictionary person1 = new NSDictionary();\n    //The NSDictionary will automatically wrap strings, numbers and dates in the respective NSObject subclasses\n    person1.put(\"Name\", \"Peter\"); //This will become a NSString\n    //Use the Java Calendar class to get a Date object\n    Calendar cal = Calendar.getInstance();\n    cal.set(2011, 1, 13, 9, 28);\n    person1.put(\"RegistrationDate\", cal.getTime()); //This will become a NSDate\n    person1.put(\"Age\", 23); //This will become a NSNumber\n    person1.put(\"Photo\", new NSData(new File(\"peter.jpg\")));\n\n    //Creation of the second object to be stored in the array\n    NSDictionary person2 = new NSDictionary();\n    person2.put(\"Name\", \"Lisa\");\n    person2.put(\"Age\", 42);\n    person2.put(\"RegistrationDate\", new NSDate(\"2010-09-23T12:32:42Z\"));\n    person2.put(\"Photo\", new NSData(new File(\"lisa.jpg\")));\n\n    //Put the objects into the array\n    people.setValue(0, person1);\n    people.setValue(1, person2);\n\n    //Put the array into the property list\n    root.put(\"People\", people);\n\n    //Save the propery list\n    XMLPropertyListWriter.write(root, new File(\"people.plist\"));\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3breadt%2Fdd-plist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3breadt%2Fdd-plist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3breadt%2Fdd-plist/lists"}