/** * Writes the Hjson representation of this value to the given writer. * <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 options options for the Hjson format * @throws IOException if an I/O error occurs in the writer */ public void writeTo(Writer writer, HjsonOptions options) throws IOException { if (options==null) throw new NullPointerException("options is null"); WritingBuffer buffer=new WritingBuffer(writer, 128); new HjsonWriter(options).save(this, buffer, 0, "", true); buffer.flush(); }
/** * Writes the Hjson representation of this value to the given writer. * <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 options options for the Hjson format * @throws IOException if an I/O error occurs in the writer */ public void writeTo(Writer writer, HjsonOptions options) throws IOException { if (options==null) throw new NullPointerException("options is null"); WritingBuffer buffer=new WritingBuffer(writer, 128); new HjsonWriter(options).save(this, buffer, 0, "", true); buffer.flush(); }
/** * Writes the JSON/Hjson 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 format controls the formatting * @throws IOException if an I/O error occurs in the writer */ public void writeTo(Writer writer, Stringify format) throws IOException { WritingBuffer buffer=new WritingBuffer(writer, 128); switch (format) { case PLAIN: new JsonWriter(false).save(this, buffer, 0); break; case FORMATTED: new JsonWriter(true).save(this, buffer, 0); break; case HJSON: new HjsonWriter(null).save(this, buffer, 0, "", true); break; } buffer.flush(); }
/** * Writes the JSON/Hjson 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 format controls the formatting * @throws IOException if an I/O error occurs in the writer */ public void writeTo(Writer writer, Stringify format) throws IOException { WritingBuffer buffer=new WritingBuffer(writer, 128); switch (format) { case PLAIN: new JsonWriter(false).save(this, buffer, 0); break; case FORMATTED: new JsonWriter(true).save(this, buffer, 0); break; case HJSON: new HjsonWriter(null).save(this, buffer, 0, "", true); break; } buffer.flush(); }