尝试使用路径而不是流:
String destPath = "filename.txt";if (!filesToDownload.isEmpty()) { for (String fileDownloadName : filesToDownload) { success = false; sftpChannel.get(fileDownloadName , destPath);编辑,如果您想使用文件和流检查此示例:
http://kodehelp.com/java-program-for-downloading-file-from-sftp-
server/



