public final class FileSystemUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static FileSystem |
get(Path path) |
static FileSystem |
get(Path path,
Config config) |
static FileSystem |
get(java.net.URI uri)
Returns a FileSystem for the given uri
TODO: need to think about security (Flink adds a safety net here, that is skipped for now)
|
static FileSystem |
get(java.net.URI uri,
Config config) |
static FileSystem |
getFileSystem(java.net.URI uri)
Returns a unsafe filesystem for the given uri
|
static FileSystem |
getFileSystem(java.net.URI uri,
Config config)
For hadoop file system
|
static void |
setDefaultScheme(Config config)
Sets the default filesystem scheme based on the user-specified configuration parameter
fs.default-scheme . |
public static FileSystem getFileSystem(java.net.URI uri, Config config) throws java.io.IOException
java.io.IOException
public static FileSystem getFileSystem(java.net.URI uri) throws java.io.IOException
java.io.IOException
public static void setDefaultScheme(Config config) throws java.io.IOException
Sets the default filesystem scheme based on the user-specified configuration parameter
fs.default-scheme
. By default this is set to file:///
and the local filesystem is used.
As an example, if set to hdfs://localhost:9000/
, then an HDFS deployment
with the namenode being on the local node and listening to port 9000 is going to be used.
In this case, a file path specified as /user/USERNAME/in.txt
is going to be transformed into hdfs://localhost:9000/user/USERNAME/in.txt
. By
default this is set to file:///
which points to the local filesystem.
config
- the configuration from where to fetch the parameter.java.io.IOException
public static FileSystem get(java.net.URI uri) throws java.io.IOException
java.io.IOException
public static FileSystem get(Path path) throws java.io.IOException
java.io.IOException
public static FileSystem get(Path path, Config config) throws java.io.IOException
java.io.IOException
public static FileSystem get(java.net.URI uri, Config config) throws java.io.IOException
java.io.IOException