You cannot convert from input stream to a FileInputStream without creating a temporal File. See: Convert InputStream into FileInputStream
If you want to read a file from remote and then write into a file:
Channel channel = session.openChannel("sftp");
channel.connect();
ChannelSftp channelSftp = (ChannelSftp) channel;
try {
InputStream inputStream = channelSftp.get(srcPath);
File file = //...
OutputStream outputStream = new FileOutputStream(file);
IOUtils.copy(inputStream, outputStream);
outputStream.close();
} finally {
channel.disconnect();
session.disconnect();
}
You can delete it after as in this response:
How to convert InputStream to virtual File