本文整理了Java中javax.json.Json.createWriter()
方法的一些代码示例,展示了Json.createWriter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Json.createWriter()
方法的具体详情如下:
包路径:javax.json.Json
类名称:Json
方法名:createWriter
[英]Creates a JSON writer to write a JSON JsonObject or JsonArraystructure to the specified byte stream. Characters written to the stream are encoded into bytes using UTF-8 encoding.
[中]创建JSON编写器,将JSON JsonObject或JsonArraystructure写入指定的字节流。写入流的字符使用UTF-8编码编码为字节。
代码示例来源:origin: apache/nifi
JsonWriter jsonWriter = Json.createWriter(stringWriter);
jsonWriter.writeObject(jsonObject);
jsonWriter.close();
代码示例来源:origin: hyperledger/fabric-sdk-java
String toJson(JsonObject toJsonFunc) {
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = Json.createWriter(new PrintWriter(stringWriter));
jsonWriter.writeObject(toJsonFunc);
jsonWriter.close();
return stringWriter.toString();
}
代码示例来源:origin: hyperledger/fabric-sdk-java
String toJson() {
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = Json.createWriter(new PrintWriter(stringWriter));
jsonWriter.writeObject(toJsonObject());
jsonWriter.close();
return stringWriter.toString();
}
代码示例来源:origin: hyperledger/fabric-sdk-java
public String toJson() {
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = Json.createWriter(new PrintWriter(stringWriter));
jsonWriter.writeObject(toJsonObject());
jsonWriter.close();
return stringWriter.toString();
}
代码示例来源:origin: hyperledger/fabric-sdk-java
String toJson() {
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = Json.createWriter(new PrintWriter(stringWriter));
jsonWriter.writeObject(toJsonObject());
jsonWriter.close();
return stringWriter.toString();
}
代码示例来源:origin: hyperledger/fabric-sdk-java
String toJson() {
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = Json.createWriter(new PrintWriter(stringWriter));
jsonWriter.writeObject(this.toJsonObject());
jsonWriter.close();
return stringWriter.toString();
}
代码示例来源:origin: hyperledger/fabric-sdk-java
String toJson() {
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = Json.createWriter(new PrintWriter(stringWriter));
jsonWriter.writeObject(toJsonObject());
jsonWriter.close();
return stringWriter.toString();
}
代码示例来源:origin: hyperledger/fabric-sdk-java
JsonWriter jsonWriter = Json.createWriter(new PrintWriter(stringWriter));
jsonWriter.writeObject(jsonObject);
jsonWriter.close();
代码示例来源:origin: org.apache.sling/org.apache.sling.distribution.core
private static void append(JsonObject json, Writer writer) throws IOException {
StringWriter buffer = new StringWriter();
Json.createWriter(buffer).writeObject(json);
writer.append(buffer.toString());
}
代码示例来源:origin: org.picketlink/picketlink-json
/**
* Gets the plainkey parameters.
*
* @return the plainkey parameters
*/
private String getPlainkeyParameters() {
StringWriter keyParameterWriter = new StringWriter();
Json.createWriter(keyParameterWriter).writeObject(this.keyParameters);
return keyParameterWriter.getBuffer().toString();
}
代码示例来源:origin: org.picketlink/picketlink-json
/**
* Gets the plain headers.
*
* @return the plain headers
*/
private String getPlainHeaders() {
StringWriter keyParameterWriter = new StringWriter();
Json.createWriter(keyParameterWriter).writeObject(this.headers);
return keyParameterWriter.getBuffer().toString();
}
}
代码示例来源:origin: com.torodb.torod.backends/common
public String to(DocStructure userObject) {
if (!initialized) {
throw new IllegalStateException("The system is not initialized");
}
StringWriter stringWriter = new StringWriter(100);
JsonWriter writer = Json.createWriter(stringWriter);
JsonObject jsonStructure = (JsonObject) userObject.accept(TO_JSON, colSchema);
writer.write(jsonStructure);
return stringWriter.toString();
}
代码示例来源:origin: agoncal/agoncal-book-javaee7
public static void main(String[] args) {
StringWriter s = new StringWriter();
JsonWriter writer = Json.createWriter(s);
writer.writeObject(buildJSon());
System.out.println(s);
}
代码示例来源:origin: org.hyperledger.fabric-sdk-java/fabric-sdk-java
String toJson() {
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = Json.createWriter(new PrintWriter(stringWriter));
jsonWriter.writeObject(this.toJsonObject());
jsonWriter.close();
return stringWriter.toString();
}
代码示例来源:origin: org.hyperledger.fabric-sdk-java/fabric-sdk-java
public String toJson() {
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = Json.createWriter(new PrintWriter(stringWriter));
jsonWriter.writeObject(toJsonObject());
jsonWriter.close();
return stringWriter.toString();
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
String toJson() {
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = Json.createWriter(new PrintWriter(stringWriter));
jsonWriter.writeObject(this.toJsonObject());
jsonWriter.close();
return stringWriter.toString();
}
代码示例来源:origin: org.hyperledger.fabric-sdk-java/fabric-sdk-java
String toJson() {
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = Json.createWriter(new PrintWriter(stringWriter));
jsonWriter.writeObject(toJsonObject());
jsonWriter.close();
return stringWriter.toString();
}
代码示例来源:origin: org.hyperledger.fabric-sdk-java/fabric-sdk-java
String toJson() {
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = Json.createWriter(new PrintWriter(stringWriter));
jsonWriter.writeObject(toJsonObject());
jsonWriter.close();
return stringWriter.toString();
}
代码示例来源:origin: org.osgi.enroute.examples.microservice/rest-service
@Override
public void writeTo(T o, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4,
MultivaluedMap<String, java.lang.Object> arg5, OutputStream out)
throws IOException, WebApplicationException {
JsonValue jv = converter.convert(o).to(JsonValue.class);
try (JsonWriter jw = Json.createWriter(out)) {
jw.write(jv);
}
}
代码示例来源:origin: fabienrenaud/java-json-benchmark
@Benchmark
@Override
public Object javaxjson() throws Exception {
javax.json.JsonObject jso = JSON_SOURCE().streamSerializer().javaxjson(JSON_SOURCE().nextPojo());
ByteArrayOutputStream baos = JsonUtils.byteArrayOutputStream();
javax.json.JsonWriter jw = javax.json.Json.createWriter(baos);
jw.writeObject(jso);
jw.close();
return baos;
}
内容来源于网络,如有侵权,请联系作者删除!