docs: 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())
          {
              System.arraycopy(EMPTY_ARRAY, 0, buffer.buffer, buffer.offset, EMPTY_ARRAY.length);
              buffer.offset += EMPTY_ARRAY.length;
              return;
          }
  
          final JsonXOutput output = new JsonXOutput(buffer, numeric, schema);
  
          try
          {
              output.writeStartArray();
  
              boolean first = true;
              for (T m : messages)
              {
                  if (first)
                  {
                      first = false;
                      output.writeStartObject();
                  }
                  else
                      output.writeCommaAndStartObject();
  
                  schema.writeTo(output, m);
                  if (output.isLastRepeated())
                      output.writeEndArray();
  
                  output.writeEndObject().reset();
              }
  
              output.writeEndArray();
          }
          catch (IOException e)
          {
              throw new RuntimeException("Serializing to a byte array threw an IOException " +
                      "(should never happen).", e);
          }
      }