org.codehaus.plexus.util.FileUtils.copyFileToDirectoryIfModified()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中org.codehaus.plexus.util.FileUtils.copyFileToDirectoryIfModified()方法的一些代码示例,展示了FileUtils.copyFileToDirectoryIfModified()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.copyFileToDirectoryIfModified()方法的具体详情如下:
包路径:org.codehaus.plexus.util.FileUtils
类名称:FileUtils
方法名:copyFileToDirectoryIfModified

FileUtils.copyFileToDirectoryIfModified介绍

[英]Copy file from source to destination only if source is newer than the target file. If destinationDirectory does not exist, it (and any parent directories) will be created. If a file source in destinationDirectory exists, it will be overwritten.
[中]仅当源文件比目标文件新时,才将文件从源文件复制到目标文件。如果destinationDirectory不存在,将创建它(和任何父目录)。如果destinationDirectory中存在文件source,则该文件将被覆盖。

代码示例

代码示例来源:origin: org.codehaus.plexus/plexus-utils

/**
 * Copy file from source to destination only if source is newer than the target file. If
 * <code>destinationDirectory</code> does not exist, it (and any parent directories) will be created. If a file
 * <code>source</code> in <code>destinationDirectory</code> exists, it will be overwritten.
 *
 * @param source An existing <code>File</code> to copy.
 * @param destinationDirectory A directory to copy <code>source</code> into.
 * @throws java.io.FileNotFoundException if <code>source</code> isn't a normal file.
 * @throws IllegalArgumentException if <code>destinationDirectory</code> isn't a directory.
 * @throws IOException if <code>source</code> does not exist, the file in <code>destinationDirectory</code> cannot
 *             be written to, or an IO error occurs during copying.
 */
public static void copyFileToDirectoryIfModified( final String source, final String destinationDirectory )
  throws IOException
{
  copyFileToDirectoryIfModified( new File( source ), new File( destinationDirectory ) );
}

代码示例来源:origin: org.codehaus.plexus/plexus-utils

copyFileToDirectoryIfModified( file, destination );

代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core

/**
 * Copy file from source to destination only if source is newer than the target file.
 * If <code>destinationDirectory</code> does not exist, it
 * (and any parent directories) will be created. If a file <code>source</code> in
 * <code>destinationDirectory</code> exists, it will be overwritten.
 *
 * @param source               An existing <code>File</code> to copy.
 * @param destinationDirectory A directory to copy <code>source</code> into.
 * @throws java.io.FileNotFoundException if <code>source</code> isn't a normal file.
 * @throws IllegalArgumentException      if <code>destinationDirectory</code> isn't a directory.
 * @throws IOException                   if <code>source</code> does not exist, the file in
 *                                       <code>destinationDirectory</code> cannot be written to, or an IO error occurs during copying.
 */
public static void copyFileToDirectoryIfModified( final String source, final String destinationDirectory )
  throws IOException
{
  copyFileToDirectoryIfModified( new File( source ), new File( destinationDirectory ) );
}

代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core

copyFileToDirectoryIfModified( file, destination );

相关文章