admin管理员组

文章数量:1122850

/***
 * 将hdfs上的文件下载到本地系统上1.0版本
 */
package itcast;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.URI;
import java.URISyntaxException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;

public class HDFSDemo {
	public static void main(String[] args) throws IOException, URISyntaxException {
		// TODO Auto-generated method stub
		FileSystem fs = FileSystem.get(new URI("hdfs://itcast01:9000"), new Configuration());
		InputStream in = fs.open(new Path("/Demo"));
		OutputStream out = new FileOutputStream("E://Demo");
		IOUtils.copy

本文标签: 文件系统javahdfs