I get input from Jsch channelSFTP as shown below.
ChannelSftp channelSftp = (ChannelSftp)channel; InputStream input=channelsftp.get(unixPath);//unixPath is path to my file which is on SFTP server
I need to attach a file in unixPath in a Spring javaMail application. But when I see the Spring JavaMail API addAttachment() , it only accepts InputStreamSource or Datasource . My problem is that I cannot get an InputStreamSource or Datasource from an inputStream, which I get as an SFTP channel. How can I get an InputStreamSource or Datasource from the above input stream? Thank you in advance.
source share