Help Center/
MapReduce Service/
Developer Guide (Normal_Earlier Than 3.x)/
Alluxio Application Development/
Application Development/
Writing Data to a File
Updated on 2022-09-14 GMT+08:00
Writing Data to a File
Function Description
The process of writing data to a file is as follows:
- Instantiate a FileSystem.
- Use the FileSystem instance to obtain various types of resources for writing data to files.
- 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); } }
Parent topic: Application Development
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.