public final class FileUtil
extends java.lang.Object
Constructor and Description |
---|
FileUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
copyFile(Configuration job,
FileStatus fileStatus) |
static java.lang.String |
copyFile(Configuration conf,
Path inFile)
Copies a file to the local file system given its path.
|
static java.lang.String |
copyFileSplit(Configuration conf,
FileSplit split)
Copies a part of a file from a remote file system (e.g., HDFS) to a local
file.
|
static CompressionCodec |
getCodec(Path file) |
static java.lang.String |
getExtensionWithoutCompression(Path path)
Returns the extension of the file after removing any possible suffixes
for compression
|
static Path[] |
getFilesListInPath(Path path)
function to list files in a certain directory
|
static long |
getPathSize(FileSystem fs,
Path path)
Get the actual size of all data in the given directory.
|
static Path |
writePathsToFile(OperationsParams params,
Path[] paths)
Writes paths to a file where each path is a line.
|
static Path |
writePathsToHDFSFile(OperationsParams params,
Path[] paths)
Writes paths to a HDFS file where each path is a line.
|
public static java.lang.String copyFile(Configuration job, FileStatus fileStatus) throws java.io.IOException
java.io.IOException
public static java.lang.String copyFileSplit(Configuration conf, FileSplit split) throws java.io.IOException
conf
- split
- java.io.IOException
public static java.lang.String copyFile(Configuration conf, Path inFile) throws java.io.IOException
conf
- inFile
- java.io.IOException
public static Path writePathsToHDFSFile(OperationsParams params, Path[] paths)
paths
- public static Path writePathsToFile(OperationsParams params, Path[] paths)
paths
- public static Path[] getFilesListInPath(Path path) throws java.io.IOException
path
- java.io.IOException
public static long getPathSize(FileSystem fs, Path path) throws java.io.IOException
fs
- - the file system that contains the pathpath
- - the path that contains the datajava.io.IOException
public static java.lang.String getExtensionWithoutCompression(Path path)
path
- public static CompressionCodec getCodec(Path file)