Package org.codehaus.jackson

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


        File tmpFile = new File(manifestFile.getPath().replace(".json", "-tmp.json"));

        JsonFactory f = new JsonFactory();
        try
        {
            JsonGenerator g = f.createJsonGenerator(tmpFile, JsonEncoding.UTF8);
            g.useDefaultPrettyPrinter();
            g.writeStartObject();
            g.writeArrayFieldStart("generations");
            for (int level = 0; level < generations.length; level++)
            {
View Full Code Here


  }

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

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

    @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

    @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

   * @throws java.io.IOException
   */
  public static void dumpConfiguration(Configuration config,
                                       Writer out) throws IOException {
    JsonFactory dumpFactory = new JsonFactory();
    JsonGenerator dumpGenerator = dumpFactory.createJsonGenerator(out);
    dumpGenerator.writeStartObject();
    dumpGenerator.writeFieldName("properties");
    dumpGenerator.writeStartArray();
    dumpGenerator.flush();
    synchronized (config) {
View Full Code Here

        File tmpFile = new File(manifestFile.getPath().replace(EXTENSION, "-tmp.json"));

        JsonFactory f = new JsonFactory();
        try
        {
            JsonGenerator g = f.createJsonGenerator(tmpFile, JsonEncoding.UTF8);
            g.useDefaultPrettyPrinter();
            g.writeStartObject();
            g.writeArrayFieldStart("generations");
            for (int level = 0; level < generations.length; level++)
            {
View Full Code Here

      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

        tmapper.configure(
            SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);
        JsonFactory tfactory = tmapper.getJsonFactory();
        FileSystem topoFS = topologyFilename.getFileSystem(getConf());
        topologyGen =
            tfactory.createJsonGenerator(topoFS.create(topologyFilename),
                JsonEncoding.UTF8);
        topologyGen.useDefaultPrettyPrinter();
      }
    }
View Full Code Here

      response.setContentType("application/json; charset=utf8");

      PrintWriter writer = response.getWriter();

      JsonFactory jsonFactory = new JsonFactory();
      JsonGenerator jg = jsonFactory.createJsonGenerator(writer);
      jg.useDefaultPrettyPrinter();
      jg.writeStartObject();
      if (mBeanServer == null) {
        jg.writeStringField("result", "ERROR");
        jg.writeStringField("message", "No MBeanServer could be found");
View Full Code Here

        File tmpFile = new File(manifestFile.getPath().replace(EXTENSION, "-tmp.json"));

        JsonFactory f = new JsonFactory();
        try
        {
            JsonGenerator g = f.createJsonGenerator(tmpFile, JsonEncoding.UTF8);
            g.useDefaultPrettyPrinter();
            g.writeStartObject();
            g.writeArrayFieldStart("generations");
            for (int level = 0; level < generations.length; level++)
            {
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.