private static long write0(
		final Iterator<?> objects,
		final OutputStream out,
		final boolean append
	)
		throws IOException
	{
		final var nco = new NonCloseableOutputStream(out);
		final var aoo = new AppendableObjectOutput(nco, append);
		try (aoo) {
			while (objects.hasNext()) {
				aoo.writeObject(objects.next());
				aoo.reset();
			}
		}

		return aoo.count();
	}
Writes the given {@code objects} to the given {@code output} stream,
using Java serialization. For the <em>first</em> objects to be written
to the stream, the {@code append} flag must be set to {@code false}.
{@snippet lang="java":
final var output = new ByteArrayOutputStream();
Serializer.write(output, List.of("1", "2", "3"), false);

var input = new ByteArrayInputStream(output.toByteArray());
final List<Object> objects = Serializer.readAllObjects(output);
assert objects.equals(List.of("1", "2", "3"));
}

When writing additional objects to the same output stream, the
{@code append} must be set to {@code true}.
{@snippet lang="java":
Serializer.write(output, List.of("4", "5"), true);
input = new ByteArrayInputStream(output.toByteArray());
objects = Serializer.readAllObjects(input);
assert objects.equals(List.of("1", "2", "3", "4", "5"));
}

It is the responsibility of the caller to close the given {@code output}
stream when no longer needed.

@see #write(Iterable, Path, OpenOption...)

@param objects the objects to write to output stream, in the order defined
       by the given iterable
@param output the output stream where the objects are written to
@param append {@code false} for the first objects written to the given
       {@code output} stream and {@code true} for additional objects
       writing to the same stream
@return the number of bytes written to the output stream
@throws IOException if writing the objects fails
@throws NullPointerException if one of the arguments is {@code null}
jenetics.incubator/src/main/java/io/jenetics/incubator/util/Serializer.java