public class FileLocalizer extends Object
Modifier and Type | Class and Description |
---|---|
static class |
FileLocalizer.DataStorageInputStreamIterator |
static class |
FileLocalizer.FetchFileRet |
Modifier and Type | Field and Description |
---|---|
static String |
LOCAL_PREFIX |
static org.apache.hadoop.fs.permission.FsPermission |
OWNER_ONLY_PERMS |
static int |
STYLE_UNIX |
static int |
STYLE_WINDOWS |
Constructor and Description |
---|
FileLocalizer() |
Modifier and Type | Method and Description |
---|---|
static OutputStream |
create(String fileSpec,
boolean append,
PigContext pigContext) |
static OutputStream |
create(String fileSpec,
PigContext pigContext) |
static boolean |
delete(String fileSpec,
PigContext pigContext) |
static void |
deleteTempFiles() |
static void |
deleteTempResourceFiles() |
static FileLocalizer.FetchFileRet |
fetchFile(Properties properties,
String filePath)
Ensures that the passed path is on the local file system, fetching it
to the java.io.tmpdir if necessary.
|
static FileLocalizer.FetchFileRet[] |
fetchFiles(Properties properties,
String filePath)
Ensures that the passed files pointed to by path are on the local file system,
fetching them to the java.io.tmpdir if necessary.
|
static FileLocalizer.FetchFileRet |
fetchResource(String name)
Ensures that the passed resource is available from the local file system, fetching
it to a temporary directory.
|
static boolean |
fileExists(String filename,
DataStorage store)
Deprecated.
Use
fileExists(String, PigContext) instead |
static boolean |
fileExists(String filename,
PigContext context) |
static String |
fullPath(String fileName,
DataStorage storage)
Deprecated.
Use
fullPath(String, PigContext) instead |
static String |
fullPath(String filename,
PigContext pigContext) |
static long |
getSize(String fileName) |
static long |
getSize(String fileName,
Properties properties) |
static org.apache.hadoop.fs.Path |
getTemporaryPath(PigContext pigContext) |
static org.apache.hadoop.fs.Path |
getTemporaryPath(PigContext pigContext,
String suffix) |
static org.apache.hadoop.fs.Path |
getTemporaryResourcePath(PigContext pigContext)
Accessor method to get the resource ContainerDescriptor used for tez resource
path bound to this thread.
|
static String |
hadoopify(String filename,
PigContext pigContext) |
static boolean |
isDirectory(String filename,
DataStorage store)
Deprecated.
Use
isDirectory(String, PigContext) instead. |
static boolean |
isDirectory(String filename,
PigContext context) |
static boolean |
isFile(String filename,
DataStorage store)
Deprecated.
Use
isFile(String, PigContext) instead |
static boolean |
isFile(String filename,
PigContext context) |
static InputStream |
open(String fileName,
ExecType execType,
DataStorage storage)
Deprecated.
Use
open(String, PigContext) instead |
static SeekableInputStream |
open(String fileSpec,
long offset,
PigContext pigContext) |
static InputStream |
open(String fileSpec,
PigContext pigContext) |
static InputStream |
openDFSFile(String fileName)
This function is meant to be used if the mappers/reducers want to access any HDFS file
|
static InputStream |
openDFSFile(String fileName,
Properties properties) |
static String |
parseCygPath(String path,
int style)
Convert path from Windows convention to Unix convention.
|
static void |
setInitialized(boolean initialized)
This method is only used by test code to reset state.
|
static void |
setR(Random r) |
public static final String LOCAL_PREFIX
public static final int STYLE_UNIX
public static final int STYLE_WINDOWS
public static org.apache.hadoop.fs.permission.FsPermission OWNER_ONLY_PERMS
public static InputStream openDFSFile(String fileName) throws IOException
fileName
- IOException
public static InputStream openDFSFile(String fileName, Properties properties) throws IOException
IOException
public static long getSize(String fileName) throws IOException
IOException
public static long getSize(String fileName, Properties properties) throws IOException
IOException
@Deprecated public static InputStream open(String fileName, ExecType execType, DataStorage storage) throws IOException
open(String, PigContext)
insteadfileName
- The filename to openexecType
- execType indicating whether executing in local mode or MapReduce mode (Hadoop)storage
- The DataStorage object used to open the fileSpecIOException
@Deprecated public static String fullPath(String fileName, DataStorage storage)
fullPath(String, PigContext)
insteadpublic static InputStream open(String fileSpec, PigContext pigContext) throws IOException
IOException
public static SeekableInputStream open(String fileSpec, long offset, PigContext pigContext) throws IOException
fileSpec
- offset
- pigContext
- IOException
- This is an overloaded version of open where there is a need to seek in stream. Currently seek is supported
only in file, not in directory or glob.public static OutputStream create(String fileSpec, PigContext pigContext) throws IOException
IOException
public static OutputStream create(String fileSpec, boolean append, PigContext pigContext) throws IOException
IOException
public static boolean delete(String fileSpec, PigContext pigContext) throws IOException
IOException
public static void setInitialized(boolean initialized)
initialized
- public static org.apache.hadoop.fs.Path getTemporaryResourcePath(PigContext pigContext) throws DataStorageException
pigContext
- DataStorageException
public static void deleteTempFiles()
public static void deleteTempResourceFiles()
public static org.apache.hadoop.fs.Path getTemporaryPath(PigContext pigContext) throws IOException
IOException
public static org.apache.hadoop.fs.Path getTemporaryPath(PigContext pigContext, String suffix) throws IOException
IOException
public static String hadoopify(String filename, PigContext pigContext) throws IOException
IOException
public static String fullPath(String filename, PigContext pigContext) throws IOException
IOException
public static boolean fileExists(String filename, PigContext context) throws IOException
IOException
@Deprecated public static boolean fileExists(String filename, DataStorage store) throws IOException
fileExists(String, PigContext)
insteadIOException
public static boolean isFile(String filename, PigContext context) throws IOException
IOException
@Deprecated public static boolean isFile(String filename, DataStorage store) throws IOException
isFile(String, PigContext)
insteadIOException
public static boolean isDirectory(String filename, PigContext context) throws IOException
IOException
@Deprecated public static boolean isDirectory(String filename, DataStorage store) throws IOException
isDirectory(String, PigContext)
instead.IOException
public static void setR(Random r)
public static String parseCygPath(String path, int style)
path
- path in Windows conventionpublic static FileLocalizer.FetchFileRet fetchFile(Properties properties, String filePath) throws IOException
IOException
public static FileLocalizer.FetchFileRet[] fetchFiles(Properties properties, String filePath) throws IOException
IOException
public static FileLocalizer.FetchFileRet fetchResource(String name) throws IOException, ResourceNotFoundException
ResourceNotFoundException
IOException
Copyright © 2007-2012 The Apache Software Foundation