public static void marshal(final OutputStream os, final Patch patch) throws XMLStreamException { marshal(os, patch, patch instanceof RollbackPatch ? ROLLBACK_1_0 : XML1_0); }
public static void marshal(final OutputStream os, final RollbackPatch patch) throws XMLStreamException { marshal(os, patch, ROLLBACK_1_0); }
public static void marshal(final OutputStream os, final Patch patch) throws XMLStreamException { marshal(os, patch, patch instanceof RollbackPatch ? ROLLBACK_1_0 : XML1_0); }
public static void marshal(final OutputStream os, final RollbackPatch patch) throws XMLStreamException { marshal(os, patch, ROLLBACK_1_0); }
/** * Write the patch.xml * * @param rollbackPatch the patch * @param file the target file * @throws IOException */ static void writePatch(final Patch rollbackPatch, final File file) throws IOException { final File parent = file.getParentFile(); if (!parent.isDirectory()) { if (!parent.mkdirs() && !parent.exists()) { throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(file.getAbsolutePath()); } } try { try (final OutputStream os = new FileOutputStream(file)){ PatchXml.marshal(os, rollbackPatch); } } catch (XMLStreamException e) { throw new IOException(e); } }
/** * Write the patch.xml * * @param rollbackPatch the patch * @param file the target file * @throws IOException */ static void writePatch(final Patch rollbackPatch, final File file) throws IOException { final File parent = file.getParentFile(); if (!parent.isDirectory()) { if (!parent.mkdirs() && !parent.exists()) { throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(file.getAbsolutePath()); } } try { try (final OutputStream os = new FileOutputStream(file)){ PatchXml.marshal(os, rollbackPatch); } } catch (XMLStreamException e) { throw new IOException(e); } }
public static void createPatchXMLFile(File dir, Patch patch, boolean logContent) throws Exception { Path patchXMLfile = dir.toPath().resolve("patch.xml"); try (Writer fos = Files.newBufferedWriter(patchXMLfile, StandardCharsets.UTF_8)){ PatchXml.marshal(fos, patch); } if(logContent) { final byte[] bytes = Files.readAllBytes(dir.toPath().resolve("patch.xml")); System.out.println(new String(bytes, StandardCharsets.UTF_8)); } }
static void process(final File targetRoot, final File distributionRoot, final Patch patch) throws IOException, XMLStreamException { try { targetRoot.mkdirs(); final InputStream is = PatchContentWriter.class.getClassLoader().getResourceAsStream(README); try { final File readme = new File(targetRoot, README); final OutputStream os = new FileOutputStream(readme); try { IoUtils.copyStream(is, os); } finally { IoUtils.safeClose(os); } } finally { IoUtils.safeClose(is); } // Write the patch xml final File patchXml = new File(targetRoot, PatchXml.PATCH_XML); final FileOutputStream os = new FileOutputStream(patchXml); try { PatchXml.marshal(os, patch); } finally { IoUtils.safeClose(os); } // Copy internalProcess(targetRoot, distributionRoot, patch); } finally { } }
protected static void writePatch(final File patchRoot, final Patch patch) throws PatchingException { FileOutputStream os = null; try { os = new FileOutputStream(new File(patchRoot, PatchXml.PATCH_XML)); PatchXml.marshal(os, patch); } catch (Exception e) { throw new PatchingException(e); } finally { IoUtils.safeClose(os); } }
PatchXml.marshal(writer, patch); } catch (Exception e) { throw new PatchingException("Failed to marshal merged metadata into " + f.getName(), e); PatchXml.marshal(writer, mergedMetadata); } catch (Exception e) { throw new PatchingException("Failed to marshal merged metadata into " + PatchXml.PATCH_XML, e);
PatchXml.marshal(writer, patch); } catch (Exception e) { throw new PatchingException("Failed to marshal merged metadata into " + f.getName(), e); PatchXml.marshal(writer, mergedMetadata); } catch (Exception e) { throw new PatchingException("Failed to marshal merged metadata into " + PatchXml.PATCH_XML, e);
private void doMarshall(String fileName) throws Exception { final String original = toString(fileName); try (final InputStream is = getResource(fileName)) { final Patch patch = PatchXml.parse(is).resolvePatch(null, null); final StringWriter writer = new StringWriter(); PatchXml.marshal(writer, patch); final String marshalled = writer.toString(); XMLUtils.compareXml(original, marshalled, false); } }