Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonFactory


                    .bufferSize(batchSize).create();
        } catch (Exception ex) {
            throw new IOException("Could not instantiate BatchGraph wrapper", ex);
        }

        final JsonFactory factory = mapper.getFactory();

        try (JsonParser parser = factory.createParser(inputStream)) {
            if (parser.nextToken() != JsonToken.START_OBJECT)
                throw new IOException("Expected data to start with an Object");

            while (parser.nextToken() != JsonToken.END_OBJECT) {
                final String fieldName = parser.getCurrentName();
View Full Code Here


* @author John Sanda
*/
public class SimulationPlanner {

    public SimulationPlan create(File jsonFile) throws Exception {
        JsonFactory jsonFactory = new JsonFactory();
        jsonFactory.enable(Feature.ALLOW_COMMENTS);
        ObjectMapper mapper = new ObjectMapper(jsonFactory);
        JsonNode root = mapper.readTree(jsonFile);
        SimulationPlan simulation = new SimulationPlan();

        simulation.setIntervalType(SimulationPlan.IntervalType.fromText(getString(root.get("intervalType"), "minutes")));
View Full Code Here

 
  private final JsonGenerator g;
//  private CharSequence transientName;
 
  public JSONDataWriter(OutputStream out) throws IOException{
    JsonFactory f = new JsonFactory();
   
    this.g = f.createJsonGenerator(out, JsonEncoding.UTF8);
    this.g.useDefaultPrettyPrinter();
  }
View Full Code Here

    currentSchema = new ObjectSchema();
    diffSchema = new DiffSchema();
    removedFields = Lists.newArrayList();

    try {
      JsonFactory factory = new JsonFactory();
      parser = factory.createJsonParser(fileSystem.open(hadoopPath));
      parser.nextToken(); // Read to the first START_OBJECT token
      generator = new SchemaIdGenerator();
    } catch (IOException e) {
      throw new ExecutionSetupException(e);
    }
View Full Code Here

            throw new MojoExecutionException("Could not create directory " + outputDirectory);
        }

        File outputFile = new File(outputDirectory, finalName + "-changes.json");

        JsonFactory factory = new JsonFactory();
        try {
            JsonGenerator generator = factory.createJsonGenerator(outputFile, JsonEncoding.UTF8);
            generator.setPrettyPrinter(new DefaultPrettyPrinter());
            try {
                generator.writeStartObject();
                generator.writeFieldName("dependencies");
                writeDependenciesDelta(addedDeps, removedDeps, updatedDeps, generator);
View Full Code Here

    }
  }

  @Override
  public void serialize( @Nonnull T object, @WillNotClose @Nonnull OutputStream out ) throws IOException {
    JsonFactory jsonFactory = JacksonSupport.getJsonFactory();
    JsonGenerator generator = jsonFactory.createGenerator( out, JsonEncoding.UTF8 );

    serialize( object, generator );
    generator.flush();
  }
View Full Code Here

  }

  @Nonnull
  public T deserialize( @Nonnull InputStream in, @Nullable Version version ) throws IOException, VersionException {
    try {
      JsonFactory jsonFactory = JacksonSupport.getJsonFactory();
      JsonParser parser = createJsonParser( jsonFactory, in );

      T deserialized = deserializeInternal( parser, version );

      JacksonParserWrapper parserWrapper = new JacksonParserWrapper( parser );
View Full Code Here

        throws Exception
    {
        int sum = 0;

        final MediaItem item = buildItem();
        JsonFactory jsonF =
//            new org.codehaus.jackson.smile.SmileFactory();
            new JsonFactory()
        ;
       
        final ObjectMapper jsonMapper = new ObjectMapper(jsonF);
        jsonMapper.registerModule(new com.fasterxml.jackson.module.afterburner.AfterburnerModule());
View Full Code Here

    }
   
    public static void main(String[] args) throws Exception
    {
//        JsonFactory f = new org.codehaus.jackson.smile.SmileFactory();
        JsonFactory f = new JsonFactory();
        ObjectMapper mapperSlow = new ObjectMapper(f);
        ObjectMapper mapperFast = new ObjectMapper(f);
       
        // !!! TEST -- to get profile info, comment out:
        mapperSlow.registerModule(new AfterburnerModule());
View Full Code Here

    }
  }

  @Override
  public void serialize( @Nonnull T object, @WillNotClose @Nonnull OutputStream out ) throws IOException {
    JsonFactory jsonFactory = JacksonSupport.getJsonFactory();
    JsonGenerator generator = jsonFactory.createGenerator( out, JsonEncoding.UTF8 );

    serialize( object, generator );
    generator.flush();
  }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.core.JsonFactory

Copyright © 2018 www.massapicom. 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.