/** * Writes a binary plist serialization of the given object as the root. * This method does not close the output stream. * * @param out the stream to write to * @param root the source of the data to write to the stream * @throws IOException If an I/O error occurs while writing to the stream or the object structure contains * data that cannot be saved. */ public static void write(OutputStream out, NSObject root) throws IOException { int minVersion = getMinimumRequiredVersion(root); if (minVersion > VERSION_00) { String versionString = minVersion == VERSION_10 ? "v1.0" : (minVersion == VERSION_15 ? "v1.5" : (minVersion == VERSION_20 ? "v2.0" : "v0.0")); throw new IOException("The given property list structure cannot be saved. " + "The required version of the binary format (" + versionString + ") is not yet supported."); } BinaryPropertyListWriter w = new BinaryPropertyListWriter(out, minVersion); w.write(root); }