首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

hadoop集群下传上载文件

2012-09-14 
hadoop集群上传下载文件//读入数据:从云端到本机(提取数据)private static void readFromHdfs()throws Fil

hadoop集群上传下载文件

//读入数据:从云端到本机(提取数据)private static void readFromHdfs()throws FileNotFoundException,IOException{//云端地址String dest = "hdfs://192.168.1.11:9000/usr/Google_三大论文中文版.pdf";//我的目录地址String mySrc = "H://Google_三大论文中文版.pdf";//得到配置Configuration conf = new Configuration();//实例化文件系统FileSystem fs = FileSystem.get(URI.create(dest), conf);//读出流FSDataInputStream hdfsInStream = fs.open(new Path(dest));//写入流OutputStream out = new FileOutputStream(mySrc);//将InputStrteam 中的内容通过IOUtils的copyBytes方法复制到out中IOUtils.copyBytes(hdfsInStream, out, 4096,true);}

?

这是一个小小的开端,今年要开始认真研究了!

?

热点排行