Package net.vieiro.plist
Class PListIO
java.lang.Object
net.vieiro.plist.PListIO
Reads and writes Java Beans to permanent storage in Apple's PLIST
(ASCII) format. Objects must be Java Beans (empty constructor, use
getters/setters), and contain properties of the following types: Lists, Maps,
String, byte[], Short, Integer, Long, Double, Float and, of course, other
nested beans. Map keys must always be Strings.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectReads a previously saved configuration from a "plist" file.static Objectread(InputStream input) Reads a previously saved configuration from a "plist" file.static voidWrites an object to a "plist" file.static voidwrite(OutputStream output, Object data) Writes an object to a "plist" file.
-
Method Details
-
read
Reads a previously saved configuration from a "plist" file.- Parameters:
input- The plist file.- Returns:
- The persisted object.
- Throws:
IOException- On error.
-
read
Reads a previously saved configuration from a "plist" file.- Parameters:
file- The plist file.- Returns:
- The persisted object.
- Throws:
IOException- On error.
-
write
Writes an object to a "plist" file. NOTE: This recursively serializes nested objects. TODO: Should this be synchronized/atomic?- Parameters:
file- The file.data- the data to persist.- Throws:
IOException- On error.
-
write
Writes an object to a "plist" file.- Parameters:
output- the OutputStream.data- the data to persist.- Throws:
IOException- On error.
-