Example usage for com.fasterxml.jackson.databind MappingJsonFactory createGenerator

List of usage examples for com.fasterxml.jackson.databind MappingJsonFactory createGenerator

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind MappingJsonFactory createGenerator.

Prototype

public JsonGenerator createGenerator(OutputStream out, JsonEncoding enc) throws IOException 

Source Link

Document

Method for constructing JSON generator for writing JSON content using specified output stream.

Usage

From source file:org.apache.arrow.vector.file.json.JsonFileWriter.java

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);
    }//from  w ww.  ja va  2 s  .  co  m
}

From source file:org.apache.arrow.vector.ipc.JsonFileWriter.java

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);
    }//www . ja v a2 s.  co m
    // Allow writing of floating point NaN values not as strings
    this.generator.configure(JsonGenerator.Feature.QUOTE_NON_NUMERIC_NUMBERS, false);
}