org.apache.hadoop.fs.FileUtil.createLocalTempFile()方法的使用及代码示例

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

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

FileUtil.createLocalTempFile介绍

[英]Create a tmp file for a base file.
[中]为基础文件创建tmp文件。

代码示例

代码示例来源:origin: KylinOLAP/Kylin

@Test
  public void testScp() throws Exception {
    if (isRemote == false)
      return;

    SSHClient ssh = new SSHClient(this.hostname, this.username, this.password);
    File tmpFile = FileUtil.createLocalTempFile(new File("/tmp/test_scp"), "temp_", false);
    ssh.scpFileToRemote(tmpFile.getAbsolutePath(), "/tmp");
  }
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

public enum LsOption {
 Recursive,
 WithBlockSize
};

代码示例来源:origin: com.facebook.hadoop/hadoop-core

public enum LsOption {
 Recursive,
 WithBlockSize
};

代码示例来源:origin: org.springframework.data/spring-data-hadoop-core

File tmp = FileUtil.createLocalTempFile(dst.getAbsoluteFile(), COPYTOLOCAL_PREFIX, true);
if (!FileUtil.copy(srcFS, src, tmp, false, srcFS.getConf())) {
  throw new IOException("Failed to copy " + src + " to " + dst);

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

File tempFile = FileUtil.createLocalTempFile(new File(""), "df.tools.UDistrib", true);
Path partsPath = new Path(tempFile.toString());
FileSystem pfs = partsPath.getFileSystem(conf);

代码示例来源:origin: org.apache.mahout/mahout-core

File tempFile = FileUtil.createLocalTempFile(new File(""), "df.tools.UDistrib", true);
Path partsPath = new Path(tempFile.toString());
FileSystem pfs = partsPath.getFileSystem(conf);

代码示例来源:origin: org.apache.mahout/mahout-mr

File tempFile = FileUtil.createLocalTempFile(new File(""), "df.tools.UDistrib", true);
Path partsPath = new Path(tempFile.toString());
FileSystem pfs = partsPath.getFileSystem(conf);

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Test (timeout = 30000)
public void testCreateLocalTempFile() throws IOException {
 setupDirs();
 final File baseFile = new File(tmp, "base");
 File tmp1 = FileUtil.createLocalTempFile(baseFile, "foo", false);
 File tmp2 = FileUtil.createLocalTempFile(baseFile, "foo", true);
 assertFalse(tmp1.getAbsolutePath().equals(baseFile.getAbsolutePath()));
 assertFalse(tmp2.getAbsolutePath().equals(baseFile.getAbsolutePath()));
 assertTrue(tmp1.exists() && tmp2.exists());
 assertTrue(tmp1.canWrite() && tmp2.canWrite());
 assertTrue(tmp1.canRead() && tmp2.canRead());
 tmp1.delete();
 tmp2.delete();
 assertTrue(!tmp1.exists() && !tmp2.exists());
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Test (timeout = 30000)
public void testCreateLocalTempFile() throws IOException {
 setupDirs();
 final File baseFile = new File(tmp, "base");
 File tmp1 = FileUtil.createLocalTempFile(baseFile, "foo", false);
 File tmp2 = FileUtil.createLocalTempFile(baseFile, "foo", true);
 assertFalse(tmp1.getAbsolutePath().equals(baseFile.getAbsolutePath()));
 assertFalse(tmp2.getAbsolutePath().equals(baseFile.getAbsolutePath()));
 assertTrue(tmp1.exists() && tmp2.exists());
 assertTrue(tmp1.canWrite() && tmp2.canWrite());
 assertTrue(tmp1.canRead() && tmp2.canRead());
 tmp1.delete();
 tmp2.delete();
 assertTrue(!tmp1.exists() && !tmp2.exists());
}

代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core

File tmp = FileUtil.createLocalTempFile(dst.getAbsoluteFile(),
                    COPYTOLOCAL_PREFIX, true);
if (!FileUtil.copy(srcFS, src, tmp, false, srcFS.getConf())) {

相关文章