当前位置: 首页>>代码示例>>Java>>正文


Java FileUtils.moveFileToDirectory方法代码示例

本文整理汇总了Java中org.apache.commons.io.FileUtils.moveFileToDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.moveFileToDirectory方法的具体用法?Java FileUtils.moveFileToDirectory怎么用?Java FileUtils.moveFileToDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.io.FileUtils的用法示例。


在下文中一共展示了FileUtils.moveFileToDirectory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeAvroSchema

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
private void writeAvroSchema(final Schema schema) throws IOException {
  // Generate schema in JAR output directory.
  final File schemaFile = new File(options.getJarOutputDir(), schema.getName() + ".avsc");

  LOG.info("Writing Avro schema file: " + schemaFile);
  FileUtils.forceMkdir(schemaFile.getParentFile());
  FileUtils.writeStringToFile(schemaFile, schema.toString(true));

  // Copy schema to code output directory.
  try {
    FileUtils.moveFileToDirectory(schemaFile, new File(options.getCodeOutputDir()), true);
  } catch (final IOException e) {
    LOG.debug("Could not move Avro schema file to code output directory.", e);
  }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:16,代码来源:DataDrivenImportJob.java

示例2: moveToDirectory

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
public void moveToDirectory(File target) {
    if (target.exists() && !target.isDirectory()) {
        throw new RuntimeException(String.format("Target '%s' is not a directory", target));
    }
    try {
        FileUtils.moveFileToDirectory(this, target, true);
    } catch (IOException e) {
        throw new RuntimeException(String.format("Could not move test file '%s' to directory '%s'", this, target), e);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:TestFile.java

示例3: moveProduct

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
/**
 * Moves product download zip into the given destination.
 * <p><b>Note:</b> generates the zip of product if necessary.</p>
 *
 * @param product     product to move.
 * @param destination destination of product
 */
private void moveProduct (Product product, String destination)
{

   if (destination == null || destination.trim ().isEmpty ())
   {
      return;
   }

   Path zip_destination = Paths.get (destination);
   String download_path = product.getDownloadablePath ();
   try
   {
      if (download_path != null)
      {
         File product_zip_file = Paths.get (download_path).toFile ();
         FileUtils.moveFileToDirectory (
               product_zip_file, zip_destination.toFile (), true);
      }
      else
      {
         Path product_path = Paths.get (product.getPath ().getPath ());
         if (UnZip.supported (product_path.toAbsolutePath ().toString ()))
         {
            FileUtils.moveFileToDirectory (
                  product_path.toFile (), zip_destination.toFile (), true);
         }
         else
         {
            zip_destination.resolve (product_path.getFileName ());
            generateZip (product_path.toFile (), zip_destination.toFile ());
         }
      }
   }
   catch (IOException e)
   {
      LOGGER.error("Cannot move product: " + product.getPath () +
            " into " + destination, e);
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:47,代码来源:FileSystemDataStore.java

示例4: move

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@ProtoMethod(description = "Move a file to a directory", example = "")
@ProtoMethodParam(params = {"name", "destination"})
public void move(String name, String to) {
    File fromFile = new File(getAppRunner().getProject().getFullPathForFile(name));
    File dir = new File(getAppRunner().getProject().getFullPathForFile(to));

    dir.mkdirs();
    try {
        FileUtils.moveFileToDirectory(fromFile, dir, false);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:14,代码来源:PFileIO.java


注:本文中的org.apache.commons.io.FileUtils.moveFileToDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。