Help Center/
MapReduce Service/
Developer Guide (Normal_Earlier Than 3.x)/
Alluxio Development Guide/
Developing an Alluxio Application/
Reading an Alluxio File
Updated on 2024-08-16 GMT+08:00
Reading an Alluxio File
Function Description
Read data from a specified file in Alluxio.
Sample Code
/** * read file * @throws java.io.IOException */ private void read() throws IOException { AlluxioURI path = new AlluxioURI(testFilePath); FileInStream in = null; try{ in = fSystem.openFile(path); byte[] buffer = new byte[1024]; int len; String content = ""; while((len = in.read(buffer)) != -1){ String bufferStr = new String(buffer,0, len); content += bufferStr; } System.out.println(content); } catch (Exception e){ System.out.println("Failed to read file. Exception:" + e); } finally { close(in); } }
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