public static void write(Feature feature, File file, String indent) throws IOException { OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); Document document = feature.document; try { String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8"; Writer w = new OutputStreamWriter(os, enc); XMLWriter xw = new XMLWriter(w); xw.setIndent(indent); try { document.toXML(xw); } finally { xw.flush(); } } finally { IOUtil.close(os); } }
public static void write(TargetDefinitionFile target, File file) throws IOException { OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); Document document = target.document; try { String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8"; Writer w = new OutputStreamWriter(os, enc); XMLWriter xw = new XMLWriter(w); try { document.toXML(xw); } finally { xw.flush(); } } finally { IOUtil.close(os); } }
public void finish(Writer w) throws IOException { base.toXML(new XMLWriter(w)); w.flush(); }
public static void write(ProductConfiguration product, File file) throws IOException { OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); Document document = product.document; try { String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8"; Writer w = new OutputStreamWriter(os, enc); XMLWriter xw = new XMLWriter(w); try { document.toXML(xw); } finally { xw.flush(); } } finally { IOUtil.close(os); } }
/** Helper method for <code>String toXML()</code> to handle the * <code>IOException</code> that <code>StringWriter</code> * will never throw. */ public static String toXML (Node n) { StringWriter buffer = new StringWriter (); XMLWriter writer = new XMLWriter (buffer); try { n.toXML (writer); } catch (IOException e) //@COBEX Note: this code will never be executed { throw new RuntimeException ("Should not happen", e); //@COBEX } return buffer.toString (); }
public static void write(TargetDefinitionFile target, File file) throws IOException { OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); Document document = target.document; try { String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8"; Writer w = new OutputStreamWriter(os, enc); XMLWriter xw = new XMLWriter(w); try { document.toXML(xw); } finally { xw.flush(); } } finally { IOUtil.close(os); } }
public static void write(Feature feature, File file, String indent) throws IOException { OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); Document document = feature.document; try { String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8"; Writer w = new OutputStreamWriter(os, enc); XMLWriter xw = new XMLWriter(w); xw.setIndent(indent); try { document.toXML(xw); } finally { xw.flush(); } } finally { IOUtil.close(os); } }
/** * Deploys provided pom.xml file under specified groupId, artifactId and version. The contents of the pom is updated * to match specified groupId, artifactId and version. */ public long deployPom(String groupId, String artifactId, String version, File pomTemplate) throws IOException { final Document pom = XMLParser.parse(pomTemplate); pom.getRootElement().getChild("groupId").setText(groupId); pom.getRootElement().getChild("artifactId").setText(artifactId); pom.getRootElement().getChild("version").setText(version); // pom.getRootElement().getChild( "packaging" ).setText( "pom" ); StringWriter buf = new StringWriter(); XMLWriter writer = new XMLWriter(buf); pom.toXML(writer); String body = buf.toString(); HttpEntity pomEntity = new StringEntity(body, ContentType.TEXT_XML); deploy(pomEntity, groupId, artifactId, version, ".pom"); return body.getBytes(Charsets.UTF_8).length; }
public static void write(Category category, File file) throws IOException { OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); Document document = category.document; try { String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8"; Writer w = new OutputStreamWriter(os, enc); XMLWriter xw = new XMLWriter(w); try { document.toXML(xw); } finally { xw.flush(); } } finally { IOUtil.close(os); } }
public static void write(IU iu, File file, String indent) throws IOException { OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); Document document = iu.document; try { String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8"; Writer w = new OutputStreamWriter(os, enc); XMLWriter xw = new XMLWriter(w); xw.setIndent(indent); try { document.toXML(xw); } finally { xw.flush(); } } finally { IOUtil.close(os); } } }
public static void write(Category category, File file) throws IOException { OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); Document document = category.document; try { String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8"; Writer w = new OutputStreamWriter(os, enc); XMLWriter xw = new XMLWriter(w); try { document.toXML(xw); } finally { xw.flush(); } } finally { IOUtil.close(os); } }
public static void write(IU iu, File file, String indent) throws IOException { OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); Document document = iu.document; try { String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8"; Writer w = new OutputStreamWriter(os, enc); XMLWriter xw = new XMLWriter(w); xw.setIndent(indent); try { document.toXML(xw); } finally { xw.flush(); } } finally { IOUtil.close(os); } } }
public static void write(ProductConfiguration product, File file) throws IOException { OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); Document document = product.document; try { String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8"; Writer w = new OutputStreamWriter(os, enc); XMLWriter xw = new XMLWriter(w); try { document.toXML(xw); } finally { xw.flush(); } } finally { IOUtil.close(os); } }
public static void write(UpdateSite site, File file) throws IOException { OutputStream os = new BufferedOutputStream(new FileOutputStream(file)); Document document = site.document; try { String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8"; Writer w = new OutputStreamWriter(os, enc); XMLWriter xw = new XMLWriter(w); try { document.toXML(xw); } finally { xw.flush(); } } finally { IOUtil.close(os); } }