HDFS Java API使用之获取FileSystem对象

package com.ibeifeng.hadoop.senior.hdfs;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;

public class HdfsApp {
    public static FileSystem getFileSystem() throws Exception{
        Configuration conf = new Configuration();
        FileSystem fileSystem = FileSystem.get(conf);
        return fileSystem;
    }
    public static void main(String[] args) throws Exception {
        FileSystem filesystem = getFileSystem();
    }

}

猜你喜欢

转载自blog.csdn.net/Chen6810/article/details/81481741