本文整理匯總了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();
}