public static <T> int writeListTo(OutputStream out, List<T> messages, Schema<T> schema,
            LinkedBuffer buffer) throws IOException
    {
        if (buffer.start != buffer.offset)
            throw new IllegalArgumentException("Buffer previously used and had not been reset.");

        final ProtobufOutput output = new ProtobufOutput(buffer);
        int totalSize = 0;
        for (T m : messages)
        {
            schema.writeTo(output, m);
            final int size = output.getSize();
            ProtobufOutput.writeRawVarInt32Bytes(out, size);
            final int msgSize = LinkedBuffer.writeTo(out, buffer);

            assert size == msgSize;

            totalSize += size;
            output.clear();
        }
        return totalSize;
    }
public static < T > int writeListTo ( OutputStream out , List < T > messages , Schema < T > schema , LinkedBuffer buffer ) throws IOException { if ( buffer . start != buffer . offset ) throw new IllegalArgumentException ( "Buffer previously used and had not been reset." ) ; final ProtobufOutput output = new ProtobufOutput ( buffer ) ; int totalSize = 0 ; for ( T m : messages ) { schema . writeTo ( output , m ) ; final int size = output . getSize ( ) ; ProtobufOutput . writeRawVarInt32Bytes ( out , size ) ; final int msgSize = LinkedBuffer . writeTo ( out , buffer ) ; assert size == msgSize ; totalSize += size ; output . clear ( ) ; } return totalSize ; }
Serializes the {@code messages} (delimited) into an {@link OutputStream} using the given schema.

@return the total size of the messages (excluding the length prefix varint)