赞
踩
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.commons.io.IOUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.FsUrlStreamHandlerFactory;
import org.apache.hadoop.fs.Path;
public class MyFSDataInputStream extends FSDataInputStream {
private static Configuration conf ;
static{
URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());
}
MyFSDataInputStream(InputStream in)
{
super(in);
}
public static void Config(){
conf= new Configuration();
conf.set(“fs.defaultFS”,“hdfs://localhost:9000”);
conf.set(“fs.hdfs.impl”,“org.apache.hadoop.h
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。