wiki:waue/2009/1026

Version 1 (modified by waue, 15 years ago) (diff)

--

  • ICAS.java 完成 上傳檔案到hdfs的程式
	static boolean upload2HDFS() {
		Configuration conf = new Configuration();
		String hdfs_src = fa_in;
		String local_src = rdc_out + "/parsed";
		Path dstPath = new Path(hdfs_src);
		try {
			FileSystem dstFs = dstPath.getFileSystem(conf);
			dstFs.copyFromLocalFile(false, new Path(local_src), new Path(
					hdfs_src));
			return true;
		} catch (IOException e) {
			e.printStackTrace();
			return false;
		}
	}