public final class HadoopFileSystem extends FileSystem implements HadoopFileSystemWrapper
FileSystem base class for the Hadoop File System. The
class is a wrapper class which encapsulated the original Hadoop HDFS API.
If no file system class is specified, the wrapper will automatically load the Hadoop
distributed file system (HDFS).FileSystem.WriteMode| Constructor and Description |
|---|
HadoopFileSystem(Class<? extends org.apache.hadoop.fs.FileSystem> fsClass)
Creates a new DistributedFileSystem object to access HDFS, based on a class name
and picking up the configuration from the class path or the Flink configuration.
|
HadoopFileSystem(org.apache.hadoop.conf.Configuration hadoopConfig,
org.apache.hadoop.fs.FileSystem hadoopFileSystem)
Creates a new DistributedFileSystem that uses the given Hadoop
FileSystem under the hood. |
| Modifier and Type | Method and Description |
|---|---|
HadoopDataOutputStream |
create(Path f,
boolean overwrite,
int bufferSize,
short replication,
long blockSize) |
HadoopDataOutputStream |
create(Path f,
FileSystem.WriteMode overwrite) |
boolean |
delete(Path f,
boolean recursive) |
long |
getDefaultBlockSize() |
BlockLocation[] |
getFileBlockLocations(FileStatus file,
long start,
long len) |
FileStatus |
getFileStatus(Path f) |
static org.apache.hadoop.conf.Configuration |
getHadoopConfiguration()
Returns a new Hadoop Configuration object using the path to the hadoop conf configured
in the main configuration (flink-conf.yaml).
|
org.apache.hadoop.fs.FileSystem |
getHadoopFileSystem()
Gets the underlying Hadoop FileSystem.
|
Class<?> |
getHadoopWrapperClassNameForFileSystem(String scheme) |
Path |
getHomeDirectory() |
URI |
getUri() |
Path |
getWorkingDirectory() |
void |
initialize(URI path) |
boolean |
isDistributedFS() |
FileStatus[] |
listStatus(Path f) |
boolean |
mkdirs(Path f) |
HadoopDataInputStream |
open(Path f) |
HadoopDataInputStream |
open(Path f,
int bufferSize) |
boolean |
rename(Path src,
Path dst) |
create, exists, get, getLocalFileSystem, getUnguardedFileSystem, initOutPathDistFS, initOutPathLocalFS, isFlinkSupportedScheme, setDefaultSchemepublic HadoopFileSystem(Class<? extends org.apache.hadoop.fs.FileSystem> fsClass) throws IOException
IOException - throw if the required HDFS classes cannot be instantiatedpublic HadoopFileSystem(org.apache.hadoop.conf.Configuration hadoopConfig,
org.apache.hadoop.fs.FileSystem hadoopFileSystem)
FileSystem under the hood.hadoopConfig - The Hadoop configuration that the FileSystem is based on.hadoopFileSystem - The Hadoop FileSystem that will be used under the hood.public static org.apache.hadoop.conf.Configuration getHadoopConfiguration()
public Path getWorkingDirectory()
getWorkingDirectory in class FileSystempublic Path getHomeDirectory()
getHomeDirectory in class FileSystempublic URI getUri()
getUri in class FileSystempublic org.apache.hadoop.fs.FileSystem getHadoopFileSystem()
public void initialize(URI path) throws IOException
initialize in class FileSystemIOExceptionpublic FileStatus getFileStatus(Path f) throws IOException
getFileStatus in class FileSystemIOExceptionpublic BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException
getFileBlockLocations in class FileSystemIOExceptionpublic HadoopDataInputStream open(Path f, int bufferSize) throws IOException
open in class FileSystemIOExceptionpublic HadoopDataInputStream open(Path f) throws IOException
open in class FileSystemIOExceptionpublic HadoopDataOutputStream create(Path f, boolean overwrite, int bufferSize, short replication, long blockSize) throws IOException
create in class FileSystemIOExceptionpublic HadoopDataOutputStream create(Path f, FileSystem.WriteMode overwrite) throws IOException
create in class FileSystemIOExceptionpublic boolean delete(Path f, boolean recursive) throws IOException
delete in class FileSystemIOExceptionpublic FileStatus[] listStatus(Path f) throws IOException
listStatus in class FileSystemIOExceptionpublic boolean mkdirs(Path f) throws IOException
mkdirs in class FileSystemIOExceptionpublic boolean rename(Path src, Path dst) throws IOException
rename in class FileSystemIOExceptionpublic long getDefaultBlockSize()
getDefaultBlockSize in class FileSystempublic boolean isDistributedFS()
isDistributedFS in class FileSystempublic Class<?> getHadoopWrapperClassNameForFileSystem(String scheme)
getHadoopWrapperClassNameForFileSystem in interface HadoopFileSystemWrapperCopyright © 2014–2017 The Apache Software Foundation. All rights reserved.