@Override public JsonGenerator createGenerator(OutputStream out, JsonEncoding enc) throws IOException { JsonGenerator generator = super.createGenerator(out, enc); generator.setPrettyPrinter(pp); return generator; }
public JsonWriter(final Job job, final File coverallsFile) throws IOException { File directory = coverallsFile.getParentFile(); if (!directory.exists()) { directory.mkdirs(); } this.job = job; this.coverallsFile = coverallsFile; this.generator = new MappingJsonFactory().createGenerator(coverallsFile, JsonEncoding.UTF8); }
public JsonWriter(final Job job, final File coverallsFile) throws IOException { File directory = coverallsFile.getParentFile(); if (!directory.exists()) { directory.mkdirs(); } this.job = job; this.coverallsFile = coverallsFile; this.generator = new MappingJsonFactory().createGenerator(coverallsFile, JsonEncoding.UTF8); }
private JsonGenerator createGenerator(Writer writer) throws IOException { return this.jsonGeneratorDecorator.decorate(jsonFactory.createGenerator(writer)); }
private JsonGenerator createGenerator(OutputStream outputStream) throws IOException { return this.jsonGeneratorDecorator.decorate(jsonFactory.createGenerator(outputStream, encoding)); }
jsonFactory.createGenerator( (OutputStream) new ByteBufOutputStream(byteBuf), JsonEncoding.UTF8)) { generator.writeStartObject();
ByteBuf byteBuf = ByteBufAllocator.DEFAULT.buffer(); try (JsonGenerator generator = jsonFactory.createGenerator( (OutputStream) new ByteBufOutputStream(byteBuf), JsonEncoding.UTF8)) { generator.writeStartObject();
public JsonFileWriter(File outputFile, JSONWriteConfig config) throws IOException { MappingJsonFactory jsonFactory = new MappingJsonFactory(); this.generator = jsonFactory.createGenerator(outputFile, JsonEncoding.UTF8); if (config.pretty) { DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter(); prettyPrinter.indentArraysWith(NopIndenter.instance); this.generator.setPrettyPrinter(prettyPrinter); } // Allow writing of floating point NaN values not as strings this.generator.configure(JsonGenerator.Feature.QUOTE_NON_NUMERIC_NUMBERS, false); }