stringHashMap =new HashMap<>();
try {
channel = (Channel) session.openChannel("sftp");
channel.connect(10000000);
ChannelSftp sftp = (ChannelSftp) channel;
try {
sftp.cd(sPath);
} catch (SftpException e) {
sftp.mkdir(sPath);
sftp.cd(sPath);
}
VectorlistFiles = sftp.ls(sftp.pwd());
for (ChannelSftp.LsEntry file : listFiles)
{
String fileName = file.getFilename();
try
{
InputStream inputStream = sftp.get(sftp.pwd() + "/" + fileName);
stringHashMap.put(fileName,inputStream);
}
catch (SftpException e)
{
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return stringHashMap;