/** * Convenience method to copy a file from a source to a destination. No filtering is performed. * * @param sourceFile the file to copy from. Must not be <code>null</code>. * @param destFile the file to copy to. Must not be <code>null</code>. * * @throws IOException if the copying fails. */ public void copyFile(File sourceFile, File destFile) throws IOException { copyFile(sourceFile, destFile, null, false, false); }
/** * Convenience method to copy a file from a source to a destination * specifying if token filtering must be used. * * @param sourceFile the file to copy from. * Must not be <code>null</code>. * @param destFile the file to copy to. * Must not be <code>null</code>. * @param filters the collection of filters to apply to this copy. * * @throws IOException if the copying fails. */ public void copyFile(File sourceFile, File destFile, FilterSetCollection filters) throws IOException { copyFile(sourceFile, destFile, filters, false, false); }
/** * Convenience method to copy a file from a source to a * destination specifying if token filtering must be used and if * source files may overwrite newer destination files. * * @param sourceFile the file to copy from. * Must not be <code>null</code>. * @param destFile the file to copy to. * Must not be <code>null</code>. * @param filters the collection of filters to apply to this copy. * @param overwrite Whether or not the destination file should be * overwritten if it already exists. * * @throws IOException if the copying fails. */ public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, boolean overwrite) throws IOException { copyFile(sourceFile, destFile, filters, overwrite, false); }
/** * Convenience method to copy a file from a source to a destination specifying if token * filtering must be used, if source files may overwrite newer destination files, the last * modified time of <code>destFile</code> file should be made equal to the last modified time * of <code>sourceFile</code> and which character encoding to assume. * * @param sourceFile the file to copy from. Must not be <code>null</code>. * @param destFile the file to copy to. Must not be <code>null</code>. * @param filters the collection of filters to apply to this copy. * @param overwrite Whether or not the destination file should be overwritten if it already * exists. * @param preserveLastModified Whether or not the last modified time of the resulting file * should be set to that of the source file. * @param encoding the encoding used to read and write the files. * * @throws IOException if the copying fails. * * @since Ant 1.5 */ public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified, String encoding) throws IOException { copyFile(sourceFile, destFile, filters, null, overwrite, preserveLastModified, encoding, null); }
/** * Convenience method to copy a file from a source to a * destination specifying if token filtering must be used, if * source files may overwrite newer destination files and the * last modified time of <code>destFile</code> file should be made equal * to the last modified time of <code>sourceFile</code>. * * @param sourceFile the file to copy from. * Must not be <code>null</code>. * @param destFile the file to copy to. * Must not be <code>null</code>. * @param filters the collection of filters to apply to this copy. * @param overwrite Whether or not the destination file should be * overwritten if it already exists. * @param preserveLastModified Whether or not the last modified time of * the resulting file should be set to that * of the source file. * * @throws IOException if the copying fails. */ public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified) throws IOException { copyFile(sourceFile, destFile, filters, overwrite, preserveLastModified, null); }
boolean overwrite, boolean preserveLastModified, String encoding, Project project) throws IOException { copyFile(sourceFile, destFile, filters, filterChains, overwrite, preserveLastModified, encoding, encoding, project);
/** * Convenience method to copy a file from a source to a destination. * No filtering is performed. * * @param sourceFile File to copy from. * Must not be <code>null</code>. * @param destFile File to copy to. * Must not be <code>null</code>. * * @exception IOException if the copying fails. * * @deprecated since 1.4.x */ @Deprecated public void copyFile(final File sourceFile, final File destFile) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile); }
/** * Convenience method to copy a file from a source to a destination. * No filtering is performed. * * @param sourceFile Name of file to copy from. * Must not be <code>null</code>. * @param destFile Name of file to copy to. * Must not be <code>null</code>. * * @exception IOException if the copying fails. * * @deprecated since 1.4.x */ @Deprecated public void copyFile(final String sourceFile, final String destFile) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile); }
/** * Convenience method to copy a file from a source to a destination. * No filtering is performed. * * @param sourceFile Name of file to copy from. * Must not be <code>null</code>. * @param destFile Name of file to copy to. * Must not be <code>null</code>. * * @throws IOException if the copying fails. */ public void copyFile(String sourceFile, String destFile) throws IOException { copyFile(new File(sourceFile), new File(destFile), null, false, false); }
/** * Convenience method to copy a file from a source to a destination * specifying if token filtering should be used. * * @param sourceFile Name of file to copy from. * Must not be <code>null</code>. * @param destFile Name of file to copy to. * Must not be <code>null</code>. * @param filtering Whether or not token filtering should be used during * the copy. * * @exception IOException if the copying fails. * * @deprecated since 1.4.x */ @Deprecated public void copyFile(final String sourceFile, final String destFile, final boolean filtering) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile, filtering ? globalFilters : null); }
/** * Convenience method to copy a file from a source to a destination specifying if token * filtering must be used and if source files may overwrite newer destination files. * * @param sourceFile Name of file to copy from. Must not be <code>null</code>. * @param destFile Name of file to copy to. Must not be <code>null</code>. * @param filters the collection of filters to apply to this copy. * @param overwrite Whether or not the destination file should be overwritten if it already * exists. * * @throws IOException if the copying fails. */ public void copyFile(String sourceFile, String destFile, FilterSetCollection filters, boolean overwrite) throws IOException { copyFile(new File(sourceFile), new File(destFile), filters, overwrite, false); }
/** * Convenience method to copy a file from a source to a destination * specifying if token filtering should be used. * * @param sourceFile File to copy from. * Must not be <code>null</code>. * @param destFile File to copy to. * Must not be <code>null</code>. * @param filtering Whether or not token filtering should be used during * the copy. * * @exception IOException if the copying fails. * * @deprecated since 1.4.x */ @Deprecated public void copyFile(final File sourceFile, final File destFile, final boolean filtering) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile, filtering ? globalFilters : null); }
/** * Convenience method to copy a file from a source to a destination * specifying if token filtering must be used. * * @param sourceFile Name of file to copy from. * Must not be <code>null</code>. * @param destFile Name of file to copy to. * Must not be <code>null</code>. * @param filters the collection of filters to apply to this copy. * * @throws IOException if the copying fails. */ public void copyFile(String sourceFile, String destFile, FilterSetCollection filters) throws IOException { copyFile(new File(sourceFile), new File(destFile), filters, false, false); }
/** * Convenience method to copy a file from a source to a * destination specifying if token filtering should be used and if * source files may overwrite newer destination files. * * @param sourceFile Name of file to copy from. * Must not be <code>null</code>. * @param destFile Name of file to copy to. * Must not be <code>null</code>. * @param filtering Whether or not token filtering should be used during * the copy. * @param overwrite Whether or not the destination file should be * overwritten if it already exists. * * @exception IOException if the copying fails. * * @deprecated since 1.4.x */ @Deprecated public void copyFile(final String sourceFile, final String destFile, final boolean filtering, final boolean overwrite) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile, filtering ? globalFilters : null, overwrite); }
/** * Convenience method to copy a file from a source to a * destination specifying if token filtering should be used and if * source files may overwrite newer destination files. * * @param sourceFile File to copy from. * Must not be <code>null</code>. * @param destFile File to copy to. * Must not be <code>null</code>. * @param filtering Whether or not token filtering should be used during * the copy. * @param overwrite Whether or not the destination file should be * overwritten if it already exists. * * @exception IOException if the file cannot be copied. * * @deprecated since 1.4.x */ @Deprecated public void copyFile(final File sourceFile, final File destFile, final boolean filtering, final boolean overwrite) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile, filtering ? globalFilters : null, overwrite); }
/** * Convenience method to copy a file from a source to a * destination specifying if token filtering should be used, if * source files may overwrite newer destination files, and if the * last modified time of the resulting file should be set to * that of the source file. * * @param sourceFile Name of file to copy from. * Must not be <code>null</code>. * @param destFile Name of file to copy to. * Must not be <code>null</code>. * @param filtering Whether or not token filtering should be used during * the copy. * @param overwrite Whether or not the destination file should be * overwritten if it already exists. * @param preserveLastModified Whether or not the last modified time of * the resulting file should be set to that * of the source file. * * @exception IOException if the copying fails. * * @deprecated since 1.4.x */ @Deprecated public void copyFile(final String sourceFile, final String destFile, final boolean filtering, final boolean overwrite, final boolean preserveLastModified) throws IOException { FILE_UTILS.copyFile(sourceFile, destFile, filtering ? globalFilters : null, overwrite, preserveLastModified); }
/** * Convenience method to copy a file from a source to a destination * specifying if token * filtering must be used, if source files may overwrite newer destination * files and the last * modified time of <code>destFile</code> file should be made equal to * the last modified time * of <code>sourceFile</code>. * * @param sourceFile Name of file to copy from. Must not be <code>null</code>. * @param destFile Name of file to copy to. Must not be <code>null</code>. * @param filters the collection of filters to apply to this copy. * @param overwrite Whether or not the destination file should be * overwritten if it already exists. * @param preserveLastModified Whether or not the last modified time of * the resulting file * should be set to that of the source file. * * @throws IOException if the copying fails. */ public void copyFile(String sourceFile, String destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified) throws IOException { copyFile(new File(sourceFile), new File(destFile), filters, overwrite, preserveLastModified); }
/** * Convenience method to copy a file from a source to a destination specifying if token * filtering must be used, if source files may overwrite newer destination files and the last * modified time of <code>destFile</code> file should be made equal to the last modified time * of <code>sourceFile</code>. * * @param sourceFile Name of file to copy from. Must not be <code>null</code>. * @param destFile Name of file to copy to. Must not be <code>null</code>. * @param filters the collection of filters to apply to this copy. * @param overwrite Whether or not the destination file should be overwritten if it already * exists. * @param preserveLastModified Whether or not the last modified time of the resulting file * should be set to that of the source file. * @param encoding the encoding used to read and write the files. * * @throws IOException if the copying fails. * * @since Ant 1.5 */ public void copyFile(String sourceFile, String destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified, String encoding) throws IOException { copyFile(new File(sourceFile), new File(destFile), filters, overwrite, preserveLastModified, encoding); }
boolean overwrite, boolean preserveLastModified, String encoding, Project project) throws IOException { copyFile(new File(sourceFile), new File(destFile), filters, filterChains, overwrite, preserveLastModified, encoding, project);
/** * Copy fromFile to toFile. * @param fromFile File * @param toFile File * @param filtering boolean * @param overwrite boolean */ private void copyFile(File fromFile, File toFile, boolean filtering, boolean overwrite) { try { log("Copying " + fromFile + " to " + toFile, verbosity); FilterSetCollection executionFilters = new FilterSetCollection(); if (filtering) { executionFilters.addFilterSet(getProject().getGlobalFilterSet()); } getFilterSets().forEach(executionFilters::addFilterSet); getFileUtils().copyFile(fromFile, toFile, executionFilters, getFilterChains(), forceOverwrite, getPreserveLastModified(), /* append: */ false, getEncoding(), getOutputEncoding(), getProject(), getForce()); } catch (IOException ioe) { throw new BuildException("Failed to copy " + fromFile + " to " + toFile + " due to " + ioe.getMessage(), ioe, getLocation()); } }