Question: Java File Management Example
Is there any ready made API in Java for creating and updating data into text file? How a programmer can write code for reading the text file?
What is best way to read a text file in Java? Is there any very easy code for this purpose?
I am working on a project where our client is sending medical data into text file format on our ftp server. We have to download the text file from the server and store on local machine ( company local server). Then our program should read the data one line at time and then process the line of data.
I know how to process the data. I am just looking for a good program to download the data from ftp server and then read the file one line at a time and process the data.
Can anyone share me the code for downloading the data from ftp server and then reading the file one line at a time?
I Java there is api in the java.io package for managing the text files. You can use these classes and Interfaces for reading binary as well as text files.
Yes you can use the Java API for reading the text file one line at a time. You have to use the BufferedReader class for buffered and fast reading of file.
You can write program for downloading the file from ftp server. You have to run the program under a scheduler. Please check the tutorial about ftp. Here you will find many examples of downloading from FTP server.