天天看点

Hadoop FSDataInputStream 和FSDataOutputStream 用法

HDFS 常用IO操作 其实我经常用的也就那几种,记住几种特定适合自己的就行

public static void testIOUtils() throws IOException {

Configuration conf = new Configuration();

FileSystem fs = FileSystem.get(conf);

Path p = new Path("/test/in/point");

FSDataInputStream fdis = fs.open(p);

IOUtils.copyBytes(fdis, System.out, conf,false);

IOUtils.closeStream(fdis);

fs.close();

}

继续阅读