本文整理了Java中org.apache.tools.ant.util.FileUtils.copyFile()
方法的一些代码示例,展示了FileUtils.copyFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.copyFile()
方法的具体详情如下:
包路径:org.apache.tools.ant.util.FileUtils
类名称:FileUtils
方法名:copyFile
[英]Convenience method to copy a file from a source to a destination. No filtering is performed.
[中]将文件从源复制到目标的简便方法。不执行任何过滤。
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
boolean overwrite, boolean preserveLastModified,
String encoding, Project project) throws IOException {
copyFile(sourceFile, destFile, filters, filterChains,
overwrite, preserveLastModified, encoding, encoding, project);
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
boolean overwrite, boolean preserveLastModified,
String encoding, Project project) throws IOException {
copyFile(new File(sourceFile), new File(destFile), filters, filterChains, overwrite,
preserveLastModified, encoding, project);
代码示例来源:origin: org.apache.ant/ant
/**
* 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());
}
}
内容来源于网络,如有侵权,请联系作者删除!