Help Center/
MapReduce Service/
Developer Guide (Normal_Earlier Than 3.x)/
Alluxio Development Guide/
Developing an Alluxio Application/
Writing Data to an Alluxio File
Updated on 2024-08-16 GMT+08:00
Writing Data to an Alluxio 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: Developing an Alluxio Application
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot