直接上代码吧
byte[] bpmnBytes = null; String filename = null; JsonNode editorNode = new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelId)); BpmnJsonConverter jsonConverter = new BpmnJsonConverter(); BpmnModel model = jsonConverter.convertToBpmnModel(editorNode); filename = model.getMainProcess().getId() + ".bpmn20.xml"; bpmnBytes = new BpmnXMLConverter().convertToXML(model); ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
字节流in中包含着已经转成bpmn文件的字节,之后怎么输出就看系统需求了