Examples of JsonWriter


Examples of com.ibm.domino.services.util.JsonWriter

      String strMethod = "url.fetchmetadata"; //json.getString("method");
      String strLink = json.getString("link");
      if ("url.fetchmetadata".equalsIgnoreCase(strMethod)) {
        URLFetcher urlFetcher = new URLFetcher(strLink);
        if (urlFetcher.fetchURL()) {
          JsonWriter jsWriter = new JsonWriter(engine
              .getHttpResponse().getWriter(), true);
          jsWriter.startObject();
          jsWriter.startProperty("result");
          jsWriter.outStringLiteral("ok");
          jsWriter.endProperty();

          // Title
          jsWriter.startProperty("title");
          jsWriter.outStringLiteral(urlFetcher.getTitle());
          jsWriter.endProperty();
          // Description
          jsWriter.startProperty("desc");
          jsWriter.outStringLiteral(urlFetcher.getDescription());
          jsWriter.endProperty();
          // url
          jsWriter.startProperty("url");
          jsWriter.outStringLiteral(urlFetcher.getURL());
          jsWriter.endProperty();

          jsWriter.startProperty("images");
          jsWriter.startArray();

          for (Iterator<String> itImg = urlFetcher.getThumbNails()
              .iterator(); itImg.hasNext();) {
            jsWriter.startArrayItem();
            jsWriter.outStringLiteral(itImg.next());
            jsWriter.endArrayItem();
          }
          jsWriter.endArray();

          jsWriter.endProperty();

          jsWriter.startProperty("opengraph");
          if (urlFetcher.getOpenGraph().size() > 0) {

            jsWriter.startObject();

            for (Iterator<String> itOG = urlFetcher.getOpenGraph()
                .keySet().iterator(); itOG.hasNext();) {
              String strOGTag = itOG.next();
              jsWriter.startProperty(strOGTag);
              jsWriter.outStringLiteral(urlFetcher.getOpenGraph()
                  .get(strOGTag));
              jsWriter.endProperty();
            }
            jsWriter.endObject();
          } else {
            jsWriter.outStringLiteral("");
          }
          jsWriter.endProperty();
          jsWriter.endObject();

          jsWriter.close();
          return;
        } else {
          ErrorJSONBuilder.getInstance().processError2JSON(engine,
              5001, urlFetcher.getError(),
              urlFetcher.getException());
View Full Code Here

Examples of com.jitlogic.zorka.common.util.JSONWriter

    public void setField(Object obj, String name, Object value) {
        ObjectInspector.setField(obj, name, value);
    }

    public String json(Object obj) {
        return new JSONWriter().write(obj);
    }
View Full Code Here

Examples of com.massivecraft.mcore.xlib.gson.stream.JsonWriter

   */
  @Override
  public String toString() {
    try {
      StringWriter stringWriter = new StringWriter();
      JsonWriter jsonWriter = new JsonWriter(stringWriter);
      jsonWriter.setLenient(true);
      Streams.write(this, jsonWriter);
      return stringWriter.toString();
    } catch (IOException e) {
      throw new AssertionError(e);
    }
View Full Code Here

Examples of com.rabbitmq.tools.json.JSONWriter

        resp.put("version", ServiceDescription.JSON_RPC_VERSION);
        if (id != null) {
            resp.put("id", id);
        }
        resp.put(label, value);
        String respStr = new JSONWriter().write(resp);
        //System.err.println(respStr);
        return respStr;
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.json.JsonWriter

    }
    ItemCollection itemCollection = new ItemCollection("name", "id", formTreeList);

        XStream xstream = new XStream(new JsonHierarchicalStreamDriver() {
            public HierarchicalStreamWriter createWriter(Writer writer) {
                return new JsonWriter(writer, JsonWriter.DROP_ROOT_MODE);
            }
        });

    return xstream.toXML(itemCollection).replace("   ", "");
  }
View Full Code Here

Examples of javax.json.JsonWriter


  public static void main(String[] args) {

    StringWriter s = new StringWriter();
    JsonWriter writer = Json.createWriter(s);
    writer.writeObject(buildJSon());
    System.out.println(s);

  }
View Full Code Here

Examples of org.amplafi.json.JSONWriter

    @BeforeMethod()
    protected void setUpObjects() {
        renderer = new JavascriptDateOutputRenderer();
        result = new StringWriter();
        jsonWriter = new JSONWriter(result);
    }
View Full Code Here

Examples of org.apache.drill.exec.vector.complex.fn.JsonWriter

    System.out.println("Map of Object[0]: " + ow.writeValueAsString(v.getAccessor().getObject(0)));
    System.out.println("Map of Object[1]: " + ow.writeValueAsString(v.getAccessor().getObject(1)));


    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    JsonWriter jsonWriter = new JsonWriter(stream, true);
    FieldReader reader = v.get("col", MapVector.class).getAccessor().getReader();
    reader.setPosition(0);
    jsonWriter.write(reader);
    reader.setPosition(1);
    jsonWriter.write(reader);
    System.out.print("Json Read: ");
    System.out.println(new String(stream.toByteArray(), Charsets.UTF_8));

    writer.clear();
View Full Code Here

Examples of org.apache.jena.atlas.json.io.JsonWriter

    }
   
    /** Write out a JSON value - pass a JSON Object to get legal exchangeable JSON */
    public static void write(IndentedWriter output, JsonValue jValue)
    {
        JsonWriter w = new JsonWriter(output) ;
        w.startOutput() ;
        jValue.visit(w) ;
        w.finishOutput() ;
    }
View Full Code Here

Examples of org.apache.sling.commons.json.io.JSONWriter

        if(writer != null) {
            throw new IllegalStateException("Output Writer already set");
        }
        response.setContentType("application/json");
        response.setCharacterEncoding("UTF-8");
        writer = new JSONWriter(response.getWriter());
        writer.setTidy(true);
        try {
            writer.array();
        } catch(JSONException jex) {
            throw (IOException)new IOException().initCause(jex);
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.