當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。