Deze pagina is nog niet beschikbaar in uw eigen taal. We werken er hard aan om meer taalversies toe te voegen. Bedankt voor uw steun.

On this page

Writing Data to a File

Updated on 2022-09-14 GMT+08:00

Function Description

The process of writing data to a file is as follows:

  1. Instantiate a FileSystem.
  2. Use the FileSystem instance to obtain various types of resources for writing data to files.
  3. Write the data to a specified file in Alluxio.

Sample Code

/**
* 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);
	}
}
Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback