本文整理了Java中org.codehaus.jettison.json.JSONObject.write()
方法的一些代码示例,展示了JSONObject.write()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.write()
方法的具体详情如下:
包路径:org.codehaus.jettison.json.JSONObject
类名称:JSONObject
方法名:write
[英]Write the contents of the JSONObject as JSON text to a writer. For compactness, no whitespace is added.
Warning: This method assumes that the data structure is acyclical.
[中]将JSONObject的内容作为JSON文本写入编写器。对于紧凑性,不添加空格。
警告:此方法假定数据结构是非循环的。
代码示例来源:origin: apache/hive
private void writeConfigJson(Path tmpDir, final FileSystem lfs,
JSONObject configs) throws IOException, JSONException {
FSDataOutputStream os = lfs.create(new Path(tmpDir, "config.json"));
OutputStreamWriter w = new OutputStreamWriter(os);
configs.write(w);
w.close();
os.close();
}
代码示例来源:origin: jersey/jersey
@Produces("*/*")
@Consumes("*/*")
public static final class General extends JettisonObjectProvider {
@Override
protected boolean isSupported(MediaType m) {
return m.getSubtype().endsWith("+json");
}
}
代码示例来源:origin: org.codehaus.jettison/jettison
public void writeEndDocument() throws XMLStreamException {
try {
root.write(writer);
writer.flush();
} catch (JSONException e) {
throw new XMLStreamException(e);
} catch (IOException e) {
throw new XMLStreamException(e);
}
}
代码示例来源:origin: org.codehaus.jettison/jettison
/**
* For clients who want to modify the output object before writing to override.
* @param root root
* @throws XMLStreamException XMLStreamException
*/
protected void writeJSONObject(JSONObject root) throws XMLStreamException {
try {
if (root == null) writer.write("null");
else root.write(writer);
} catch (JSONException e) {
throw new XMLStreamException(e);
} catch (IOException e) {
throw new XMLStreamException(e);
}
}
代码示例来源:origin: com.sun.jersey/jersey-json
@Produces("*/*")
@Consumes("*/*")
public static final class General extends JSONObjectProvider {
@Override
protected boolean isSupported(MediaType m) {
return m.getSubtype().endsWith("+json");
}
}
代码示例来源:origin: org.codehaus.jettison/jettison
((JSONObject)v).write(writer);
} else if (v instanceof JSONArray) {
((JSONArray)v).write(writer);
代码示例来源:origin: org.codehaus.jettison/jettison
((JSONObject)v).write(writer);
} else if (v instanceof JSONArray) {
((JSONArray)v).write(writer);
代码示例来源:origin: org.codehaus.jettison/com.springsource.org.codehaus.jettison
public void writeEndDocument() throws XMLStreamException {
try {
root.write(writer);
writer.flush();
} catch (JSONException e) {
throw new XMLStreamException(e);
} catch (IOException e) {
throw new XMLStreamException(e);
}
}
代码示例来源:origin: org.codehaus.jettison/com.springsource.org.codehaus.jettison
public void writeEndDocument() throws XMLStreamException {
try {
root.write(writer);
writer.flush();
} catch (JSONException e) {
throw new XMLStreamException(e);
} catch (IOException e) {
throw new XMLStreamException(e);
}
}
代码示例来源:origin: org.apache.hive/hive-llap-server
private void writeConfigJson(Path tmpDir, final FileSystem lfs,
JSONObject configs) throws IOException, JSONException {
FSDataOutputStream os = lfs.create(new Path(tmpDir, "config.json"));
OutputStreamWriter w = new OutputStreamWriter(os);
configs.write(w);
w.close();
os.close();
}
代码示例来源:origin: org.glassfish.jersey.media/jersey-media-json-jettison
@Produces("*/*")
@Consumes("*/*")
public static final class General extends JettisonObjectProvider {
@Override
protected boolean isSupported(MediaType m) {
return m.getSubtype().endsWith("+json");
}
}
代码示例来源:origin: com.sun.jersey/jersey-bundle
@Produces("*/*")
@Consumes("*/*")
public static final class General extends JSONObjectProvider {
@Override
protected boolean isSupported(MediaType m) {
return m.getSubtype().endsWith("+json");
}
}
代码示例来源:origin: org.glassfish.jersey.media/jersey-media-json
@Produces("*/*")
@Consumes("*/*")
public static final class General extends JsonObjectProvider {
@Override
protected boolean isSupported(MediaType m) {
return m.getSubtype().endsWith("+json");
}
}
代码示例来源:origin: jersey/jersey-1.x
@Produces("*/*")
@Consumes("*/*")
public static final class General extends JSONObjectProvider {
@Override
protected boolean isSupported(MediaType m) {
return m.getSubtype().endsWith("+json");
}
}
代码示例来源:origin: com.onpositive.aml/com.mulesoft.jaxrs.raml.generator
/**
* <p>transformObjectToString.</p>
*
* @param object a {@link org.codehaus.jettison.json.JSONObject} object.
* @return a {@link java.lang.String} object.
* @throws org.codehaus.jettison.json.JSONException if any.
* @throws java.io.IOException if any.
*/
static public String transformObjectToString(JSONObject object) throws JSONException, IOException
{
StringWriter sw = new StringWriter() ;
object.write(sw) ;
StringWriter sw1 = new StringWriter() ;
StringEscapeUtils.unescapeJavaScript( sw1, sw.toString() );
String result = sw1.toString() ;
return result;
}
代码示例来源:origin: com.netflix.karyon/karyon2-admin-web
result.write(out);
} else {
out.append(jsonp).append("(");
result.write(out);
out.append(");");
代码示例来源:origin: org.codehaus.jettison/com.springsource.org.codehaus.jettison
Object v = this.myHashMap.get(k);
if (v instanceof JSONObject) {
((JSONObject)v).write(writer);
} else if (v instanceof JSONArray) {
((JSONArray)v).write(writer);
代码示例来源:origin: org.codehaus.jettison/com.springsource.org.codehaus.jettison
((JSONObject)v).write(writer);
} else if (v instanceof JSONArray) {
((JSONArray)v).write(writer);
代码示例来源:origin: com.onpositive.aml/com.mulesoft.jaxrs.raml.generator
JSONObject obj = new JSONObject(content);
StringWriter wr = new StringWriter();
obj.write(wr);
canonic = StringEscapeUtils.unescapeJavaScript(wr.toString());
代码示例来源:origin: com.peterphi.user-manager/user-manager-api
obj.put("error", error);
obj.write(sw);
内容来源于网络,如有侵权,请联系作者删除!