private Serializer createSerialiser() { try { Serializer serializer = new StickySerializer(new FileOutputStream(project.getFile()), "UTF-8"); if (!System.lineSeparator().equals(lineSeparator.value())) getLog().info(String.format("The line separator is configured to %s, not using system line separator", lineSeparator)); serializer.setLineSeparator(lineSeparator.value()); return serializer; } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } catch (FileNotFoundException e) { throw new RuntimeException(e); } }
private Serializer createSerialiser() { try { Serializer serializer = new StickySerializer(new FileOutputStream(project.getFile()), "UTF-8"); if (!System.lineSeparator().equals(lineSeparator.value())) getLog().info(String.format("The line separator is configured to %s, not using system line separator", lineSeparator)); serializer.setLineSeparator(lineSeparator.value()); return serializer; } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } catch (FileNotFoundException e) { throw new RuntimeException(e); } }
private static void printDocument(Document document) { Serializer serializer = new Serializer(System.out); serializer.setLineSeparator("\n"); serializer.setIndent(2); try { serializer.write(document); } catch (IOException e) { throw new RuntimeException(e); } } }
private static void printDocument(Document document) { Serializer serializer = new Serializer(System.out); serializer.setLineSeparator("\n"); serializer.setIndent(2); try { serializer.write(document); } catch (IOException e) { throw new RuntimeException(e); } } }
public static String graphToXml(Graph graph) { Document document = new Document(convertToXml(graph)); OutputStream out = new ByteArrayOutputStream(); Serializer serializer = new Serializer(out); serializer.setLineSeparator("\n"); serializer.setIndent(2); try { serializer.write(document); } catch (IOException e) { throw new RuntimeException(e); } return out.toString(); }
serializer.setIndent(2); serializer.setMaxLength(80); serializer.setLineSeparator("\n"); serializer.write(document); z_out.flush();
public void actionPerformed(ActionEvent e) { try { File outfile = EditorUtils.getSaveFile("bayesim", "xml", this.bayesImEditor, false, "Save Bayes IM as XML..."); BayesIm bayesIm = bayesImEditor.getWizard().getBayesIm(); FileOutputStream out = new FileOutputStream(outfile); Element element = BayesXmlRenderer.getElement(bayesIm); Document document = new Document(element); Serializer serializer = new Serializer(out); serializer.setLineSeparator("\n"); serializer.setIndent(2); serializer.write(document); out.close(); } catch (IOException e1) { throw new RuntimeException(e1); } } }