Class PListIO

java.lang.Object
net.vieiro.plist.PListIO

public final class PListIO extends Object
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 Details

    • read

      public static Object read(InputStream input) throws IOException
      Reads a previously saved configuration from a "plist" file.
      Parameters:
      input - The plist file.
      Returns:
      The persisted object.
      Throws:
      IOException - On error.
    • read

      public static Object read(File file) throws IOException
      Reads a previously saved configuration from a "plist" file.
      Parameters:
      file - The plist file.
      Returns:
      The persisted object.
      Throws:
      IOException - On error.
    • write

      public static void write(File file, Object data) throws IOException
      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

      public static void write(OutputStream output, Object data) throws IOException
      Writes an object to a "plist" file.
      Parameters:
      output - the OutputStream.
      data - the data to persist.
      Throws:
      IOException - On error.