有没有任何Java库可以读写plist文件,包括它们的二进制格式?
dd-plist可以读写Cocoa框架二进制.plist
文件。
NSDictionary rootDict = (NSDictionary) PropertyListParser.parse(new File("my.plist"));
for (String name : rootDict.allKeys()) {
NSObject value = rootDict.objectForKey(name);
System.out.println(name + " = " + value);
}
PropertyListParser.convertToXml(new File("my.plist"), new File("my.xml"));
PropertyListParser.parse
可以读取 .plist
以及 .xml
格式的文件。
你试过使用Apache Commons Configuration吗?他们似乎提供了你所需要的PropertyListConfiguration
和org.apache.commons.configuration.plist
包中的其他类。