Examples of createJsonGenerator()


Examples of com.fasterxml.jackson.core.JsonFactory.createJsonGenerator()

  final JsonGenerator jsonGenerator;

  public MetricToJsonVisitor(OutputStream os) throws IOException {
    JsonFactory jsonFactory = buildJsonFactory();
    JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(os);

    this.jsonGenerator = jsonGenerator;
  }

  public MetricToJsonVisitor(Writer writer) throws IOException {
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonFactory.createJsonGenerator()

    this.jsonGenerator = jsonGenerator;
  }

  public MetricToJsonVisitor(Writer writer) throws IOException {
    JsonFactory jsonFactory = buildJsonFactory();
    JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(writer);
    jsonGenerator.useDefaultPrettyPrinter();
    this.jsonGenerator = jsonGenerator;
  }

  private JsonFactory buildJsonFactory() {
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonFactory.createJsonGenerator()

//  private CharSequence transientName;
 
  public JSONDataWriter(OutputStream out) throws IOException{
    JsonFactory f = new JsonFactory();
   
    this.g = f.createJsonGenerator(out, JsonEncoding.UTF8);
    this.g.useDefaultPrettyPrinter();
  }
 
  private String s(CharSequence seq) {
    String s = (seq instanceof String) ? (String) seq : seq.toString();
View Full Code Here

Examples of com.fasterxml.jackson.databind.MappingJsonFactory.createJsonGenerator()

    @Override
    public String marshall(T obj) {
        try {
            JsonFactory jsonFactory = new MappingJsonFactory();
            StringWriter output = new StringWriter();
            JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(output);
            jsonGenerator.writeObject(obj);
            return output.toString();
        } catch ( Exception e ) {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of org.codehaus.jackson.JsonFactory.createJsonGenerator()

    Schema avroSchema = Schema.parse(schema);
    ObjectMapper mapper = new ObjectMapper();
    JsonFactory factory = new JsonFactory();
    StringWriter writer = new StringWriter();
    JsonGenerator jgen = factory.createJsonGenerator(writer);
    jgen.useDefaultPrettyPrinter();

    @SuppressWarnings("checked")
    HashMap<String,Object> schemaMap = new ObjectMapper().readValue(schema, HashMap.class);
View Full Code Here

Examples of org.codehaus.jackson.JsonFactory.createJsonGenerator()

                       ". Generated at " + df.format(new Date(System.currentTimeMillis())));

      ObjectMapper mapper = new ObjectMapper();
      JsonFactory factory = new JsonFactory();
      StringWriter writer = new StringWriter();
      JsonGenerator jgen = factory.createJsonGenerator(writer);
      jgen.useDefaultPrettyPrinter();
      mapper.writeValue(jgen, field);
      return writer.getBuffer().toString();
    }
    catch(Exception ex)
View Full Code Here

Examples of org.codehaus.jackson.JsonFactory.createJsonGenerator()

         throws JsonGenerationException, JsonMappingException, IOException
  {
    JsonFactory jsonFactory = new JsonFactory(new ObjectMapper());

    StringWriter out = new StringWriter(1000);
    JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(out);
    if (pretty) jsonGenerator.useDefaultPrettyPrinter();
    jsonGenerator.writeObject(bean);
    out.flush();

    return out.toString();
View Full Code Here

Examples of org.codehaus.jackson.JsonFactory.createJsonGenerator()

    tableInfo.add(columnInfo5);
   
    ObjectMapper objectMapper = new ObjectMapper();     
    JsonFactory jsonFactory = new JsonFactory()
    StringWriter writer = new StringWriter();
    JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(writer);
    objectMapper.writeValue(jsonGenerator, tableInfo);
    String jsonString = writer.toString();
    when(context.getConfiguration().get(HIHOConf.COLUMN_INFO)).thenReturn(jsonString);
   
    mapper.setup(context);
View Full Code Here

Examples of org.codehaus.jackson.JsonFactory.createJsonGenerator()

  public static String getJsonStringOfColumnInfo(ArrayList<ColumnInfo> columnInfo) throws IOException {
    ObjectMapper mapper = new ObjectMapper();     
    JsonFactory jsonFactory = new JsonFactory()
    StringWriter writer = new StringWriter();
    JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(writer);
    mapper.writeValue(jsonGenerator, columnInfo);
    String jsonString = writer.toString();
    return jsonString;
  }
View Full Code Here

Examples of org.codehaus.jackson.JsonFactory.createJsonGenerator()

      ObjectMapper jmapper = new ObjectMapper();
      jmapper.configure(
          SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);
      JsonFactory jfactory = jmapper.getJsonFactory();
      FileSystem jobFS = jobTraceFilename.getFileSystem(getConf());
      jobTraceGen = jfactory.createJsonGenerator(
          jobFS.create(jobTraceFilename), JsonEncoding.UTF8);
      if (prettyprintTrace) {
        jobTraceGen.useDefaultPrettyPrinter();
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.