public class FileUtils
extends java.lang.Object
Constructor and Description |
---|
FileUtils() |
Modifier and Type | Method and Description |
---|---|
static org.apache.hadoop.fs.Path |
getLocalTemporaryPath(java.lang.String name,
org.apache.hadoop.mapreduce.TaskAttemptContext context)
Returns a temporary directory path.
|
static org.apache.hadoop.io.compress.CompressionCodec |
getPreferredCompressionCodec(org.apache.hadoop.conf.Configuration conf)
Returns the preferred compression codec.
|
static org.apache.hadoop.io.compress.CompressionCodec |
getPreferredCompressionCodec(org.apache.hadoop.mapreduce.TaskAttemptContext context)
Returns the preferred compression codec.
|
static java.io.DataInputStream |
getTemporaryFileInputStream(org.apache.hadoop.fs.Path path,
org.apache.hadoop.mapreduce.TaskAttemptContext context)
Creates an input stream from the given path of a file.
|
static java.io.DataOutputStream |
getTemporaryFileOutputStream(org.apache.hadoop.fs.Path path,
org.apache.hadoop.mapreduce.TaskAttemptContext context)
Creates an output stream to the given path of a file.
|
public static org.apache.hadoop.fs.Path getLocalTemporaryPath(java.lang.String name, org.apache.hadoop.mapreduce.TaskAttemptContext context)
name
- The name of directorycontext
- Hadoop context to create new directorypublic static java.io.DataInputStream getTemporaryFileInputStream(org.apache.hadoop.fs.Path path, org.apache.hadoop.mapreduce.TaskAttemptContext context) throws java.io.IOException
path
- The path of a filecontext
- Hadoop context to open a filejava.io.IOException
public static java.io.DataOutputStream getTemporaryFileOutputStream(org.apache.hadoop.fs.Path path, org.apache.hadoop.mapreduce.TaskAttemptContext context) throws java.io.IOException
path
- The path of a filecontext
- Hadoop context to create a filejava.io.IOException
public static org.apache.hadoop.io.compress.CompressionCodec getPreferredCompressionCodec(org.apache.hadoop.conf.Configuration conf)
This method returns SnappyCodec object if it is available, otherwise DefaultCodec object is returned.
conf
- Hadoop configuration objectpublic static org.apache.hadoop.io.compress.CompressionCodec getPreferredCompressionCodec(org.apache.hadoop.mapreduce.TaskAttemptContext context)
context
- Hadoop context object