Reputation: 892
I am currently using JSch to access some files using SFTP and I also need to perform some changes in each file once it is on the remote server.
I am able to access and read the files using ChannelSftp
but I would like to create a temporary file while in this remote directory as well. I cannot see a way to do this. I have the ability to make directories and remove files, but not create an empty file? Is this something you can do using ChannelSftp
?
Upvotes: 1
Views: 6564
Reputation: 1723
You can put an arbitrary file from an InputStream: put(InputStream src, String dst)
. You can upload an empty file with that as follows:
put( new ByteArrayInputStream( "".getBytes() ), "tempfile");
Upvotes: 4