/** * Serializes the {@code messages} into the writer using the given schema. */ public static <T> void writeListTo(Writer writer, List<T> messages, Schema<T> schema, boolean numeric) throws IOException { final JsonGenerator generator = DEFAULT_JSON_FACTORY.createJsonGenerator(writer); try { writeListTo(generator, messages, schema, numeric); } finally { generator.close(); } }
/** * Serializes the {@code messages} into the stream using the given schema. * * The {@link LinkedBuffer}'s internal byte array will be used as the primary buffer * when writing the message. */ public static <T> void writeListTo(OutputStream out, List<T> messages, Schema<T> schema, boolean numeric, LinkedBuffer buffer) throws IOException { final IOContext context = new IOContext(DEFAULT_JSON_FACTORY._getBufferRecycler(), out, false); final JsonGenerator generator = newJsonGenerator(out, buffer.buffer, 0, false, context); try { writeListTo(generator, messages, schema, numeric); } finally { generator.close(); } }
/** * Serializes the {@code messages} into the stream using the given schema. * * The {@link LinkedBuffer}'s internal byte array will be used as the primary buffer * when writing the message. */ public static <T> void writeListTo(OutputStream out, List<T> messages, Schema<T> schema, boolean numeric, LinkedBuffer buffer) throws IOException { final IOContext context = new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), out, false); final SmileGenerator generator = newSmileGenerator(out, buffer.buffer, 0, false, context); //final SmileGenerator generator = DEFAULT_SMILE_FACTORY.createJsonGenerator(out); try { JsonIOUtil.writeListTo(generator, messages, schema, numeric); } finally { generator.close(); } }
/** * 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(); } }
/** * 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_JSON_FACTORY._getBufferRecycler(), out, false); final JsonGenerator generator = newJsonGenerator(out, context.allocWriteEncodingBuffer(), 0, true, context); /*final JsonGenerator generator = DEFAULT_JSON_FACTORY.createJsonGenerator(out, JsonEncoding.UTF8);*/ try { writeListTo(generator, messages, schema, numeric); } finally { generator.close(); } }