How to read OSX .plist files from Java?

♀尐吖头ヾ 提交于 2019-11-30 23:05:21

问题


How to read OSX .plist files from Java?


回答1:


Imho running a commandline tool from Java is not quite the "best way to do the job".

There are several much better ways to deal with binary plist in JAVA: That one I prefere is an usefull little project by Daniel Dreibrodt at: google project hosting

You can also use Apache Commons Configuration (which API is supporting the Property List format). More information about the history of the .plist-format on OSX (which version introduced which format) I wrote up on my blog

Update: There is a new project hosted at source forge called Property List Library, that shall be able to read AND write .plist- I have not tested it, but it sounds interesting.




回答2:


I guess you refer to the plist format used on Mac starting with Mac OS X (and not the NeXTSTEP or GNUstep format).

  1. Determine if the file is in XML or binary format
  2. If in binary format use the plutil command-line-utility to convert file to xml format
  3. Now you have the file in xml format, use any java-xml-library to handle the plist



回答3:


You can use this library:

Property List Library (SourceForge)

It will read property list files to objects and vice versa.




回答4:


Simplified java XML/plist reading.




回答5:


These days the Java Preferences API on a Mac automatically uses plist files and they are in binary format. You might be able to read the plist automatically simply by reading the preferences at the "node".

I hope that helps.



来源:https://stackoverflow.com/questions/1749197/how-to-read-osx-plist-files-from-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!