public static <T> void writeListTo(LinkedBuffer buffer,
            List<T> messages, Schema<T> schema, boolean numeric)
    {
        if (buffer.start != buffer.offset)
        {
            throw new IllegalArgumentException("Buffer previously used and had not been reset.");
        }

        if (messages.isEmpty())
        {
            return;
        }

        MsgpackXOutput output = new MsgpackXOutput(buffer, numeric, schema);

        try
        {

            for (T m : messages)
            {

                LinkedBuffer objectStarter = output.writeStartObject();
                schema.writeTo(output, m);

                if (output.isLastRepeated())
                {
                    output.writeEndArray();
                }

                output.writeEndObject(objectStarter);

            }

        }
        catch (IOException e)
        {
            throw new RuntimeException("Serializing to a byte array threw an IOException " +
                    "(should never happen).", e);
        }
    }
Serializes the {@code messages} into the {@link LinkedBuffer} using the given schema.
protostuff-msgpack/src/main/java/io/protostuff/MsgpackXIOUtil.java