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.IOException
public static File createTempFile(File parent, String name) throws IOException
parent
- Parent directory.name
- File name.IOException
public static File createTempDir(File parent, String name) throws IOException
parent
- Parent directory.name
- Directory name.IOException
public static File createTestTempFileOrDir(File parent, String name, boolean dir) throws IOException
parent
- Parent directoryname
- Name of filedir
- Is directory?IOException
public static void writeLines(File file, String[] lines) throws IOException
file
- File to write lines tolines
- Strings written to the fileIOException
public 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 removeIOException
public 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 removeIOException
Copyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.