开发者

Is there any Java library that can read and write plist files, including binary format?

开发者 https://www.devze.com 2023-03-13 22:07 出处:网络
Is there any Ja开发者_运维百科va library that can read and write plist files, including in their binary format?dd-plist can read and write Cocoa framework binary .plist files.

Is there any Ja开发者_运维百科va library that can read and write plist files, including in their binary format?


dd-plist can read and write Cocoa framework binary .plist files.

NSDictionary rootDict = (NSDictionary) PropertyListParser.parse(new File("my.plist"));
for (String name : rootDict.allKeys()) {
    NSObject value = rootDict.objectForKey(name);
    System.out.println(name + " = " + value);
}

It can also convert a plist to XML and back. e.g.:

PropertyListParser.convertToXml(new File("my.plist"), new File("my.xml"));

PropertyListParser.parse can then read back .plist as well as .xml format.


Note: there's also Apache Commons Configuration, but it can only read/write old-style (ASCII) plist files, which are never used on iOS or macOS nowadays.


Have you tried using Apache Commons Configuration ? They seem to provide what you're looking for using PropertyListConfiguration and other classes of the org.apache.commons.configuration.plist package.

0

精彩评论

暂无评论...
验证码 换一张
取 消