Exemplo n.º 1
0
  /** Serializes the {@code messages} into the stream using the given schema. */
  public static <T> void writeListTo(
      OutputStream out, List<T> messages, Schema<T> schema, boolean numeric) throws IOException {
    final IOContext context = new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), out, false);

    final SmileGenerator generator =
        newSmileGenerator(out, context.allocWriteEncodingBuffer(), 0, true, context);

    // final SmileGenerator generator = DEFAULT_SMILE_FACTORY.createJsonGenerator(out);
    try {
      JsonIOUtil.writeListTo(generator, messages, schema, numeric);
    } finally {
      generator.close();
    }
  }