當前位置: 首頁>>代碼示例>>Java>>正文


Java RawLocalFileSystem.pathToFile方法代碼示例

本文整理匯總了Java中org.apache.hadoop.fs.RawLocalFileSystem.pathToFile方法的典型用法代碼示例。如果您正苦於以下問題:Java RawLocalFileSystem.pathToFile方法的具體用法?Java RawLocalFileSystem.pathToFile怎麽用?Java RawLocalFileSystem.pathToFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.fs.RawLocalFileSystem的用法示例。


在下文中一共展示了RawLocalFileSystem.pathToFile方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sameVolRename

import org.apache.hadoop.fs.RawLocalFileSystem; //導入方法依賴的package包/類
/**
 * Rename srcPath to dstPath on the same volume. This is the same
 * as RawLocalFileSystem's rename method, except that it will not
 * fall back to a copy, and it will create the target directory
 * if it doesn't exist.
 */
private void sameVolRename(Path srcPath,
    Path dstPath) throws IOException {
  RawLocalFileSystem rfs = (RawLocalFileSystem)this.rfs;
  File src = rfs.pathToFile(srcPath);
  File dst = rfs.pathToFile(dstPath);
  if (!dst.getParentFile().exists()) {
    if (!dst.getParentFile().mkdirs()) {
      throw new IOException("Unable to rename " + src + " to "
          + dst + ": couldn't create parent directory"); 
    }
  }
  
  if (!src.renameTo(dst)) {
    throw new IOException("Unable to rename " + src + " to " + dst);
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:23,代碼來源:MapTask.java

示例2: sameVolRename

import org.apache.hadoop.fs.RawLocalFileSystem; //導入方法依賴的package包/類
/**
 * Rename srcPath to dstPath on the same volume. This is the same as
 * RawLocalFileSystem's rename method, except that it will not fall back to a
 * copy, and it will create the target directory if it doesn't exist.
 */
protected void sameVolRename(Path srcPath, Path dstPath) throws IOException {
  RawLocalFileSystem rfs = (RawLocalFileSystem) this.rfs;
  File src = rfs.pathToFile(srcPath);
  File dst = rfs.pathToFile(dstPath);
  if (!dst.getParentFile().exists()) {
    if (!dst.getParentFile().mkdirs()) {
      throw new IOException("Unable to rename " + src + " to " + dst
          + ": couldn't create parent directory");
    }
  }

  if (!src.renameTo(dst)) {
    throw new IOException("Unable to rename " + src + " to " + dst);
  }
}
 
開發者ID:apache,項目名稱:incubator-tez,代碼行數:21,代碼來源:ExternalSorter.java

示例3: sameVolRename

import org.apache.hadoop.fs.RawLocalFileSystem; //導入方法依賴的package包/類
/**
     * Rename srcPath to dstPath on the same volume. This is the same
     * as RawLocalFileSystem's rename method, except that it will not
     * fall back to a copy, and it will create the target directory
     * if it doesn't exist.
     */
    private void sameVolRename(Path srcPath,
        Path dstPath) throws IOException {
      RawLocalFileSystem rfs = (RawLocalFileSystem)this.rfs;
      File src = rfs.pathToFile(srcPath);
      File dst = rfs.pathToFile(dstPath);
      if (!dst.getParentFile().exists()) {
        if (!dst.getParentFile().mkdirs()) {
          throw new IOException("Unable to rename " + src + " to "
              + dst + ": couldn't create parent directory"); 
        }
      }
    
try {
      Process myProc = Runtime.getRuntime().exec("mv " + src.toString() + " " + dst.toString());
		
			myProc.waitFor();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new IOException("Unable to rename " + src + " to " + dst);
		}
  
      //if (!src.renameTo(dst)) {
//	System.out.println("MapTask.sameVolRename(): src=" + src.toString() + " dst=" + dst.toString());
 //       throw new IOException("Unable to rename " + src + " to " + dst);
  //    }
    }
 
開發者ID:Seagate,項目名稱:hadoop-on-lustre2,代碼行數:34,代碼來源:MapTask.java


注:本文中的org.apache.hadoop.fs.RawLocalFileSystem.pathToFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。