更新时间:2022-07-19 GMT+08:00
分享

写文件

功能简介

写文件过程为:

  1. 实例化一个FileSystem。
  2. 由此FileSystem实例获取写文件的各类资源。
  3. 将待写内容写入到Alluxio的指定文件中。

代码样例

/**
* create file,write file
*/
private void write() throws IOException {
	final String content = "hi, I am bigdata. It is successful if you can see me.";
	FileOutStream out = null;
	try {
		AlluxioURI path = new AlluxioURI(testFilePath);
		out = fSystem.createFile(path);
		out.write(content.getBytes());
	}
	catch (Exception e){
		System.out.println("Failed to write file. Exception:" + e);
	}
	finally {
		close(out);
	}
}
分享:

    相关文档

    相关产品