本文整理匯總了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);
}
}
示例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);
}
}
示例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);
// }
}