public static <T> int writeDelimitedTo(DataOutput out, T message, Schema<T> schema)
            throws IOException
    {
        final LinkedBuffer buffer = new LinkedBuffer(LinkedBuffer.MIN_BUFFER_SIZE);
        final ProtobufOutput output = new ProtobufOutput(buffer);
        schema.writeTo(output, message);
        final int size = output.getSize();
        ProtobufOutput.writeRawVarInt32Bytes(out, size);

        final int msgSize = LinkedBuffer.writeTo(out, buffer);

        assert size == msgSize;

        return size;
    }
Used by the code generated messages that implement {@link java.io.Externalizable}. Writes to the
{@link DataOutput} .

@return the size of the message.
protostuff-core/src/main/java/io/protostuff/ProtobufIOUtil.java