public class FileUtil {
private static class SingleFileUtill{
private static FileSystem fs = null;
static{
fs = SingleFileUtill.getInstance();
}
private static FileSystem getInstance(){
Configuration conf = new Configuration();
FileSystem fs = null;
try {
fs = FileSystem.get(conf);
return fs;
} catch (IOException e) {
e.printStackTrace();
}
return fs;
}
}
public static FileSystem getFileSystem(){
return SingleFileUtill.fs;
}
}
转载于:https://www.cnblogs.com/cunchen/p/9464194.html