本文整理汇总了Java中javax.json.stream.JsonGenerator.flush方法的典型用法代码示例。如果您正苦于以下问题:Java JsonGenerator.flush方法的具体用法?Java JsonGenerator.flush怎么用?Java JsonGenerator.flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.json.stream.JsonGenerator
的用法示例。
在下文中一共展示了JsonGenerator.flush方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeTo
import javax.json.stream.JsonGenerator; //导入方法依赖的package包/类
@Override
public void writeTo(VirtualInstanceCollection virtualInstanceCollection, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws UnsupportedEncodingException {
String charSet = "UTF-8";
JsonGenerator jg = Json.createGenerator(new OutputStreamWriter(entityStream, charSet));
jg.writeStartArray();
Matrix4d gM = new Matrix4d();
gM.setIdentity();
PartLink virtualRootPartLink = getVirtualRootPartLink(virtualInstanceCollection);
List<PartLink> path = new ArrayList<>();
path.add(virtualRootPartLink);
InstanceBodyWriterTools.generateInstanceStreamWithGlobalMatrix(productService, path, gM, virtualInstanceCollection, new ArrayList<>(), jg);
jg.writeEnd();
jg.flush();
}
示例2: writeLeaf
import javax.json.stream.JsonGenerator; //导入方法依赖的package包/类
private static void writeLeaf(List<PartLink> currentPath, List<Integer> copyInstanceIds, PartIteration partI, Matrix4d combinedMatrix, JsonGenerator jg) {
String partIterationId = partI.toString();
List<InstanceAttributeDTO> attributes = new ArrayList<>();
for (InstanceAttribute attr : partI.getInstanceAttributes()) {
attributes.add(mapper.map(attr, InstanceAttributeDTO.class));
}
jg.writeStartObject();
jg.write("id", Tools.getPathInstanceAsString(currentPath, copyInstanceIds));
jg.write("partIterationId", partIterationId);
jg.write("path", Tools.getPathAsString(currentPath));
writeMatrix(combinedMatrix, jg);
writeGeometries(partI.getSortedGeometries(), jg);
writeAttributes(attributes, jg);
jg.writeEnd();
jg.flush();
}
示例3: writeTo
import javax.json.stream.JsonGenerator; //导入方法依赖的package包/类
@Override
public void writeTo(InstanceCollection instanceCollection, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws UnsupportedEncodingException {
String charSet = "UTF-8";
JsonGenerator jg = Json.createGenerator(new OutputStreamWriter(entityStream, charSet));
jg.writeStartArray();
Matrix4d gM = new Matrix4d();
gM.setIdentity();
InstanceBodyWriterTools.generateInstanceStreamWithGlobalMatrix(productService, null, gM, instanceCollection, new ArrayList<>(), jg);
jg.writeEnd();
jg.flush();
}