public class FileUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static File |
createTempDir(File parent,
String name)
Make a temporary directory.
|
static File |
createTempFile(File parent,
String name)
Make a temporary file.
|
static File |
createTestDir(String computationName)
Create a temporary folder that will be removed after the test.
|
static File |
createTestTempFileOrDir(File parent,
String name,
boolean dir)
Create a test temp file or directory.
|
static void |
delete(File dir)
Recursively delete a directory
|
static void |
deletePath(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path path)
Helper method to remove a path if it exists.
|
static void |
deletePath(org.apache.hadoop.conf.Configuration conf,
String path)
Helper method to remove a path if it exists.
|
static void |
writeLines(File file,
String[] lines)
Write lines to a file.
|
public static File createTestDir(String computationName) throws IOException
computationName - Used for generating the folder name.IOExceptionpublic static File createTempFile(File parent, String name) throws IOException
parent - Parent directory.name - File name.IOExceptionpublic static File createTempDir(File parent, String name) throws IOException
parent - Parent directory.name - Directory name.IOExceptionpublic static File createTestTempFileOrDir(File parent, String name, boolean dir) throws IOException
parent - Parent directoryname - Name of filedir - Is directory?IOExceptionpublic static void writeLines(File file, String[] lines) throws IOException
file - File to write lines tolines - Strings written to the fileIOExceptionpublic static void delete(File dir)
dir - Directory to deletepublic static void deletePath(org.apache.hadoop.conf.Configuration conf,
String path)
throws IOException
conf - Configuration to load FileSystem frompath - Path to removeIOExceptionpublic static void deletePath(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path path)
throws IOException
conf - Configuration to load FileSystem frompath - Path to removeIOExceptionCopyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.