I have to read a log file on a remote server and based on the error code I need to download some of the files on it to my application server. I have written code for downloading/uploading files and its working fine. But I am struck on reading the file. I dont wanna download the log file, I wanna open it and read the error codes from it. I dont find any correct method for doing this
This is the code I am using for downloading files..
But I dont wanna download that file, but I wanna open and read its contents.
hmm its 4:30 in the evening and I am out of ideas, and I posted it here ..
Hi EveryOne, I saw some of the posts as ,to read a file from Remote Server they are telling first we have to download file to local and read that file.
from my point of view no need to download file. We can open an Inputstream on that file and read the content. below is the example.
String hostname = "";
String username = "";
String password = "";
//Connect to SFTP server location as below
SshParameters params = new SshParameters(hostname,username,password);
Sftp sftp = new Sftp(params);
//Once connected to server get InputStream as below