Examples of JsonFactory


Examples of com.fasterxml.jackson.core.JsonFactory

    }

    public String toString(){
        StringWriter stringWriter = new StringWriter();
        try {
            JsonGenerator jsonGenerator = new JsonFactory().createGenerator(stringWriter);
            if(solution == null) writeProblem(jsonGenerator);
            else writeSolution(jsonGenerator);
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonFactory



    public void write(File jsonFile){
        try {
            JsonGenerator jsonGenerator = new JsonFactory().createGenerator(new FileOutputStream(jsonFile), JsonEncoding.UTF8);
            if(solution == null) writeProblem(jsonGenerator);
            else writeSolution(jsonGenerator);
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonFactory

    public static Result metrics(String classPrefix, boolean pretty) throws Exception {
        response().setContentType("application/json");
        response().setHeader("Cache-Control", "must-revalidate,no-cache,no-store");

        StringWriter writer = new StringWriter();
        JsonFactory factory = new JsonFactory(new ObjectMapper());
        final JsonGenerator json = factory.createGenerator(writer);
        if (pretty) {
            json.useDefaultPrettyPrinter();
        }
        json.writeStartObject();
        {
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonFactory

  protected void readMappings() throws IOException, JsonParseException,
      JsonMappingException {
    // Read mapping out of JSON file
    ObjectMapper mapper = new ObjectMapper();
    JsonFactory factory = new JsonFactory();
    InputStream is = this.getClass().getResourceAsStream(MAPPING_FILE);
    JsonParser jp = factory.createParser(is);

    jp.nextToken();
    mappings.clear();
    while (jp.nextToken() == JsonToken.START_OBJECT) {
      URLMapping mapping = mapper.readValue(jp, URLMapping.class);
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonFactory

public class MetricToJsonVisitor implements MetricDataVisitor, Closeable {

  final JsonGenerator jsonGenerator;

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

    this.jsonGenerator = jsonGenerator;
  }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonFactory

    this.jsonGenerator = jsonGenerator;
  }

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

Examples of com.fasterxml.jackson.core.JsonFactory

    jsonGenerator.useDefaultPrettyPrinter();
    this.jsonGenerator = jsonGenerator;
  }

  private JsonFactory buildJsonFactory() {
    return new JsonFactory();
  }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonFactory

   */

  final JsonParser jsonParser;

  JsonMetricDataStream(InputStream is) throws IOException {
    JsonFactory jsonFactory = new JsonFactory();
    this.jsonParser = jsonFactory.createJsonParser(is);
  }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonFactory

  public MetricTreeSerializer(JsonFactory jsonFactory) {
    this.jsonFactory = jsonFactory;
  }

  public MetricTreeSerializer() {
    this(new JsonFactory());
  }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonFactory

        throw new UnsupportedOperationException();
    }


    public void parse(InputSource input) throws IOException, SAXException {
        JsonParser jsonParser = new JsonFactory().createParser(input.getCharacterStream());
        new JsonSaxAdapter(jsonParser, contentHandler, namespaceUri, addTypeAttributes, artificialRootName, elementNameConverter).parse();
    }
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.