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

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

        try
        {
            LinkedBuffer objectStarter = output.writeStartObject();
            schema.writeTo(output, message);

            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 message} into a {@link LinkedBuffer} via {@link JsonXOutput} using the given {@code schema}
with the supplied buffer.
protostuff-msgpack/src/main/java/io/protostuff/MsgpackXIOUtil.java