/** * Convenience method to copy content from one Resource to another. * No filtering is performed. * * @param source the Resource to copy from. * Must not be <code>null</code>. * @param dest the Resource to copy to. * Must not be <code>null</code>. * * @throws IOException if the copying fails. * * @since Ant 1.7 */ public static void copyResource(final Resource source, final Resource dest) throws IOException { copyResource(source, dest, null); }
/** * Convenience method to copy content from one Resource to another. * No filtering is performed. * * @param source the Resource to copy from. * Must not be <code>null</code>. * @param dest the Resource to copy to. * Must not be <code>null</code>. * @param project the project instance. * * @throws IOException if the copying fails. * * @since Ant 1.7 */ public static void copyResource(final Resource source, final Resource dest, final Project project) throws IOException { copyResource(source, dest, null, null, false, false, null, null, project); }
final Project project) throws IOException { copyResource(source, dest, filters, filterChains, overwrite, preserveLastModified, false, inputEncoding, outputEncoding, project);
final Project project) throws IOException { copyResource(source, dest, filters, filterChains, overwrite, preserveLastModified, append, inputEncoding, outputEncoding, project, /* force: */ false);
/** * Does the work. * * @exception BuildException if something goes wrong with the build */ public void execute() throws BuildException { try { ResourceUtils.copyResource( new StringResource(message.isEmpty() ? System.lineSeparator() : message), output == null ? new LogOutputResource(this, logLevel) : output, null, null, false, false, append, null, encoding.isEmpty() ? null : encoding, getProject(), force); } catch (IOException ioe) { throw new BuildException(ioe, getLocation()); } }
String inputEncoding, String outputEncoding, Project project, boolean force) throws IOException { ResourceUtils.copyResource(new FileResource(sourceFile), new FileResource(destFile), filters, filterChains, overwrite,
executionFilters.addFilterSet(filterSet); ResourceUtils.copyResource(fromResource, new FileResource(destDir, toFile),
/** * Execute the concat task. */ @Override public void execute() { validate(); if (binary && dest == null) { throw new BuildException( "dest|destfile attribute is required for binary concatenation"); } ResourceCollection c = getResources(); if (isUpToDate(c)) { log(dest + " is up-to-date.", Project.MSG_VERBOSE); return; } if (c.isEmpty() && ignoreEmpty) { return; } try { //most of these are defaulted because the concat-as-a-resource code hijacks a lot: ResourceUtils.copyResource(new ConcatResource(c), dest == null ? new LogOutputResource(this, Project.MSG_WARN) : dest, null, null, true, false, append, null, null, getProject(), force); } catch (IOException e) { throw new BuildException("error concatenating content to " + dest, e); } }
File tmpFile = fu.createTempFile("modified-", ".tmp", null, true, false); Resource tmpResource = new FileResource(tmpFile); ResourceUtils.copyResource(resource, tmpResource); boolean isSelected = isSelected(tmpFile.getParentFile(), tmpFile.getName(),
/** * Creates a copy of the target archive in update or recreate mode * because some entries may later be read and archived from it. */ private File maybeCopyTarget() { File copyOfDest = null; try { if (!Mode.FORCE_CREATE.equals(getMode().getValue()) && !Mode.CREATE.equals(getMode().getValue())) { copyOfDest = FILE_UTILS.createTempFile(getTaskName(), ".tmp", null, true, false); ResourceUtils.copyResource(getDest(), new FileResource(copyOfDest)); } } catch (IOException ioex) { if (copyOfDest != null && copyOfDest.exists()) { FILE_UTILS.tryHardToDelete(copyOfDest); } throw new BuildException("Failed to copy target archive", ioex); } return copyOfDest; }
/** * Process an individual file with sardine.put() */ private void process(File file, URL dest, boolean expectContinue) throws Exception { log("putting " + file + " to " + dest + " with expectContinue=" + expectContinue, Project.MSG_VERBOSE); if (filterSets.hasFilters() || !filterChains.isEmpty()) { Resource filteredResult; File tempFile = null; if (inMemoryFiltering) { filteredResult = new StringResource(); } else { tempFile = File.createTempFile("filterResult", ".tmp"); filteredResult = new FileResource(tempFile); } try { ResourceUtils.copyResource(new FileResource(file), filteredResult, filterSets, filterChains, false, false, false, inputEncoding, outputEncoding, getProject()); getSardine().put(dest.toString(), filteredResult.getInputStream(), contentType, expectContinue); } finally { FileUtils.delete(tempFile); } } else { getSardine().put(dest.toString(), file, contentType, expectContinue); } }
ResourceUtils.copyResource(this.stylesheet, destStylesheet);