/** * Gets the default file system URI that is used for paths and file systems * that do not specify and explicit scheme. * * <p>As an example, assume the default file system URI is set to {@code 'hdfs://someserver:9000/'}. * A file path of {@code '/user/USERNAME/in.txt'} is interpreted as * {@code 'hdfs://someserver:9000/user/USERNAME/in.txt'}. * * @return The default file system URI */ public static URI getDefaultFsUri() { return defaultScheme != null ? defaultScheme : LocalFileSystem.getLocalFsURI(); }
@Override public String getScheme() { return LocalFileSystem.getLocalFsURI().getScheme(); }
@Override public FileSystem getFileSystem() throws Exception { org.apache.hadoop.fs.FileSystem fs = new RawLocalFileSystem(); fs.initialize(LocalFileSystem.getLocalFsURI(), new Configuration()); return new HadoopFileSystem(fs); }
@Test public void testExplicitlySetToLocal() throws Exception { final Configuration conf = new Configuration(); conf.setString(CoreOptions.DEFAULT_FILESYSTEM_SCHEME, LocalFileSystem.getLocalFsURI().toString()); FileSystem.initialize(conf); URI justPath = new URI(tempFolder.newFile().toURI().getPath()); assertNull(justPath.getScheme()); FileSystem fs = FileSystem.get(justPath); assertEquals("file", fs.getUri().getScheme()); }
/** * Gets the default file system URI that is used for paths and file systems * that do not specify and explicit scheme. * * <p>As an example, assume the default file system URI is set to {@code 'hdfs://someserver:9000/'}. * A file path of {@code '/user/USERNAME/in.txt'} is interpreted as * {@code 'hdfs://someserver:9000/user/USERNAME/in.txt'}. * * @return The default file system URI */ public static URI getDefaultFsUri() { return DEFAULT_SCHEME != null ? DEFAULT_SCHEME : LocalFileSystem.getLocalFsURI(); }
/** * Gets the default file system URI that is used for paths and file systems * that do not specify and explicit scheme. * * <p>As an example, assume the default file system URI is set to {@code 'hdfs://someserver:9000/'}. * A file path of {@code '/user/USERNAME/in.txt'} is interpreted as * {@code 'hdfs://someserver:9000/user/USERNAME/in.txt'}. * * @return The default file system URI */ public static URI getDefaultFsUri() { return defaultScheme != null ? defaultScheme : LocalFileSystem.getLocalFsURI(); }
@Override public String getScheme() { return LocalFileSystem.getLocalFsURI().getScheme(); }
@Override public String getScheme() { return LocalFileSystem.getLocalFsURI().getScheme(); }