public String finish() { return base.toXML(); }
public void finish(Writer w) throws IOException { base.toXML(new XMLWriter(w)); w.flush(); }
/** * Saves the pom.xml if its been changed * * @return true if the pom was modified * @throws IOException */ public boolean saveIfChanged() throws IOException { if (updated) { LOG.info("Updating " + pom); try { IOHelpers.writeFully(pom, doc.toXML()); } catch (Exception e) { throw new IOException("failed to save " + pom + ". " + e, e); } } return updated; }
public void writeXml(Document doc, File file) throws IOException { File parentDir = file.getParentFile(); if (parentDir != null) { parentDir.mkdirs(); } XMLWriter writer = new XMLWriter(new FileWriter(file)); doc.toXML(writer); writer.close(); }
public void writeXml(Document doc, File file) throws IOException { File parentDir = file.getParentFile(); if (parentDir != null) { parentDir.mkdirs(); } XMLWriter writer = new XMLWriter(new FileWriter(file)); doc.toXML(writer); writer.close(); }
/** * Saves the pom.xml if its been changed * * @return true if the pom was modified * @throws IOException */ public boolean saveIfChanged() throws IOException { if (updated) { LOG.info("Updating " + pom); try { IOHelpers.writeFully(pom, doc.toXML()); } catch (Exception e) { throw new IOException("failed to save " + pom + ". " + e, e); } } return updated; }
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(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(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(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(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); } }
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(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); } }
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(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( 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 ); } }
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(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); } } }
/** * 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; }