aspose file tools
The moose likes Java in General and the fly likes Retrieval of values from a file in a remote server using JSch library Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Retrieval of values from a file in a remote server using JSch library" Watch "Retrieval of values from a file in a remote server using JSch library" New topic
Author

Retrieval of values from a file in a remote server using JSch library

Shikha Upadhyaya
Ranch Hand

Joined: Aug 17, 2011
Posts: 70

Hi,

I tried the code in this website to retrieve a file from remote server to my local system. It is working fine. But is there any way to directly read the values from the file without actually copying the file to the local system? How do I do it?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

You can't read anything from the file without copying it to your local system. That's also happening when you view any web page on the Internet; you download it first before your browser displays it.

That doesn't mean that you need to store it in a file. Instead of using a FileOutputStream you can use a ByteArrayOutputStream, then call its toByteArray() method to get the remote file contents in a byte[].


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Shikha Upadhyaya
Ranch Hand

Joined: Aug 17, 2011
Posts: 70

Rob Spoor wrote:You can't read anything from the file without copying it to your local system. That's also happening when you view any web page on the Internet; you download it first before your browser displays it.

That doesn't mean that you need to store it in a file. Instead of using a FileOutputStream you can use a ByteArrayOutputStream, then call its toByteArray() method to get the remote file contents in a byte[].

Oh ok. I will try this. Thanks
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

You're welcome.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Retrieval of values from a file in a remote server using JSch library
 
Similar Threads
jsch file copy from Linux to Windows
File Upload Error - Using JSCH/SFTP
File Upload through JSP
Java remote paths
Connecting two linux machines using smb