public class FileLocalizer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
FileLocalizer.DataStorageInputStreamIterator |
static class |
FileLocalizer.FetchFileRet |
Modifier and Type | Field and Description |
---|---|
static java.lang.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 java.io.OutputStream |
create(java.lang.String fileSpec,
boolean append,
PigContext pigContext) |
static java.io.OutputStream |
create(java.lang.String fileSpec,
PigContext pigContext) |
static boolean |
delete(java.lang.String fileSpec,
PigContext pigContext) |
static void |
deleteTempFiles() |
static void |
deleteTempResourceFiles() |
static FileLocalizer.FetchFileRet |
fetchFile(java.util.Properties properties,
java.lang.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(java.util.Properties properties,
java.lang.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(java.lang.String name)
Ensures that the passed resource is available from the local file system, fetching
it to a temporary directory.
|
static boolean |
fileExists(java.lang.String filename,
DataStorage store)
Deprecated.
Use
fileExists(String, PigContext) instead |
static boolean |
fileExists(java.lang.String filename,
PigContext context) |
static java.lang.String |
fullPath(java.lang.String fileName,
DataStorage storage)
Deprecated.
Use
fullPath(String, PigContext) instead |
static java.lang.String |
fullPath(java.lang.String filename,
PigContext pigContext) |
static long |
getSize(java.lang.String fileName) |
static long |
getSize(java.lang.String fileName,
java.util.Properties properties) |
static org.apache.hadoop.fs.Path |
getTemporaryPath(PigContext pigContext) |
static org.apache.hadoop.fs.Path |
getTemporaryPath(PigContext pigContext,
java.lang.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 java.lang.String |
hadoopify(java.lang.String filename,
PigContext pigContext) |
static boolean |
isDirectory(java.lang.String filename,
DataStorage store)
Deprecated.
Use
isDirectory(String, PigContext) instead. |
static boolean |
isDirectory(java.lang.String filename,
PigContext context) |
static boolean |
isFile(java.lang.String filename,
DataStorage store)
Deprecated.
Use
isFile(String, PigContext) instead |
static boolean |
isFile(java.lang.String filename,
PigContext context) |
static java.io.InputStream |
open(java.lang.String fileName,
ExecType execType,
DataStorage storage)
Deprecated.
Use
open(String, PigContext) instead |
static SeekableInputStream |
open(java.lang.String fileSpec,
long offset,
PigContext pigContext) |
static java.io.InputStream |
open(java.lang.String fileSpec,
PigContext pigContext) |
static java.io.InputStream |
openDFSFile(java.lang.String fileName)
This function is meant to be used if the mappers/reducers want to access any HDFS file
|
static java.io.InputStream |
openDFSFile(java.lang.String fileName,
java.util.Properties properties) |
static java.lang.String |
parseCygPath(java.lang.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(java.util.Random r) |
public static final java.lang.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 java.io.InputStream openDFSFile(java.lang.String fileName) throws java.io.IOException
fileName
- java.io.IOException
public static java.io.InputStream openDFSFile(java.lang.String fileName, java.util.Properties properties) throws java.io.IOException
java.io.IOException
public static long getSize(java.lang.String fileName) throws java.io.IOException
java.io.IOException
public static long getSize(java.lang.String fileName, java.util.Properties properties) throws java.io.IOException
java.io.IOException
@Deprecated public static java.io.InputStream open(java.lang.String fileName, ExecType execType, DataStorage storage) throws java.io.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 fileSpecjava.io.IOException
@Deprecated public static java.lang.String fullPath(java.lang.String fileName, DataStorage storage)
fullPath(String, PigContext)
insteadpublic static java.io.InputStream open(java.lang.String fileSpec, PigContext pigContext) throws java.io.IOException
java.io.IOException
public static SeekableInputStream open(java.lang.String fileSpec, long offset, PigContext pigContext) throws java.io.IOException
fileSpec
- offset
- pigContext
- java.io.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 java.io.OutputStream create(java.lang.String fileSpec, PigContext pigContext) throws java.io.IOException
java.io.IOException
public static java.io.OutputStream create(java.lang.String fileSpec, boolean append, PigContext pigContext) throws java.io.IOException
java.io.IOException
public static boolean delete(java.lang.String fileSpec, PigContext pigContext) throws java.io.IOException
java.io.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 java.io.IOException
java.io.IOException
public static org.apache.hadoop.fs.Path getTemporaryPath(PigContext pigContext, java.lang.String suffix) throws java.io.IOException
java.io.IOException
public static java.lang.String hadoopify(java.lang.String filename, PigContext pigContext) throws java.io.IOException
java.io.IOException
public static java.lang.String fullPath(java.lang.String filename, PigContext pigContext) throws java.io.IOException
java.io.IOException
public static boolean fileExists(java.lang.String filename, PigContext context) throws java.io.IOException
java.io.IOException
@Deprecated public static boolean fileExists(java.lang.String filename, DataStorage store) throws java.io.IOException
fileExists(String, PigContext)
insteadjava.io.IOException
public static boolean isFile(java.lang.String filename, PigContext context) throws java.io.IOException
java.io.IOException
@Deprecated public static boolean isFile(java.lang.String filename, DataStorage store) throws java.io.IOException
isFile(String, PigContext)
insteadjava.io.IOException
public static boolean isDirectory(java.lang.String filename, PigContext context) throws java.io.IOException
java.io.IOException
@Deprecated public static boolean isDirectory(java.lang.String filename, DataStorage store) throws java.io.IOException
isDirectory(String, PigContext)
instead.java.io.IOException
public static void setR(java.util.Random r)
public static java.lang.String parseCygPath(java.lang.String path, int style)
path
- path in Windows conventionpublic static FileLocalizer.FetchFileRet fetchFile(java.util.Properties properties, java.lang.String filePath) throws java.io.IOException
java.io.IOException
public static FileLocalizer.FetchFileRet[] fetchFiles(java.util.Properties properties, java.lang.String filePath) throws java.io.IOException
java.io.IOException
public static FileLocalizer.FetchFileRet fetchResource(java.lang.String name) throws java.io.IOException, ResourceNotFoundException
ResourceNotFoundException
java.io.IOException
Copyright © 2007-2012 The Apache Software Foundation