public static long write(
		final Iterable<?> objects,
		final Path path,
		final OpenOption... options
	)
		throws IOException
	{
		final OpenOption[] opts;
		if (options.length != 0) {
			opts = options;
		} else {
			if (Files.exists(path)) {
				opts = new OpenOption[] { APPEND };
			} else {
				opts = new OpenOption[] { CREATE, APPEND };
			}
		}

		return write0(objects::iterator, path, opts);
	}
Writes the given {@code objects} to the given {@code path}, using
Java serialization. If the {@code path} already exists and the open
{@code options} contains {@link StandardOpenOption#APPEND}, the objects
are appended to the existing file.
{@snippet lang="java":
// Write three string objects to the given file. The file is created if
// it does not exist or appended if the file already exists.
Serializer.write(path, List.of("1", "2", "3"));
}

Truncating an existing file:
{@snippet lang="java":
// Write three string objects to the given file. The file is truncated if
// it exists or created if the file doesn't exist.
Serializer.write(
    path, List.of("1", "2", "3"),
    StandardOpenOption.TRUNCATE_EXISTING
);
}

@see #write(Iterable, OutputStream, boolean)

@param objects the {@code objects} to be written
@param path the destination where the {@code objects} are written to
@param options specifying how the file is opened
@return the number of bytes written to the file
@throws IOException if writing the objects fails
@throws IllegalArgumentException if options contain an invalid
        combination of options
@throws UnsupportedOperationException if an unsupported option is
        specified
@throws NullPointerException if one of the arguments is {@code null}
jenetics.incubator/src/main/java/io/jenetics/incubator/util/Serializer.java