/** * Writes the JSON representation of this value to the given writer using the given formatting. * <p> * Writing performance can be improved by using a {@link java.io.BufferedWriter BufferedWriter}. * </p> * * @param writer * the writer to write this value to * @param config * a configuration that controls the formatting or <code>null</code> for the minimal form * @throws IOException * if an I/O error occurs in the writer */ public void writeTo(Writer writer, WriterConfig config) throws IOException { if (writer == null) { throw new NullPointerException("writer is null"); } if (config == null) { throw new NullPointerException("config is null"); } WritingBuffer buffer = new WritingBuffer(writer, 128); write(config.createWriter(buffer)); buffer.flush(); }
/** * Writes the JSON representation of this value to the given writer using the given formatting. * <p> * Writing performance can be improved by using a {@link java.io.BufferedWriter BufferedWriter}. * </p> * * @param writer * the writer to write this value to * @param config * a configuration that controls the formatting or <code>null</code> for the minimal form * @throws IOException * if an I/O error occurs in the writer */ public void writeTo(Writer writer, WriterConfig config) throws IOException { if (writer == null) { throw new NullPointerException("writer is null"); } if (config == null) { throw new NullPointerException("config is null"); } WritingBuffer buffer = new WritingBuffer(writer, 128); write(config.createWriter(buffer)); buffer.flush(); }
/** * Writes the JSON representation of this value to the given writer using the given formatting. * <p> * Writing performance can be improved by using a {@link java.io.BufferedWriter BufferedWriter}. * </p> * * @param writer * the writer to write this value to * @param config * a configuration that controls the formatting or <code>null</code> for the minimal form * @throws IOException * if an I/O error occurs in the writer */ public void writeTo(Writer writer, WriterConfig config) throws IOException { if (writer == null) { throw new NullPointerException("writer is null"); } if (config == null) { throw new NullPointerException("config is null"); } WritingBuffer buffer = new WritingBuffer(writer, 128); write(config.createWriter(buffer)); buffer.flush(); }