Is there any way to lock file, which i am reading with JSch sftp channel, to prevent other applications to modificate it while session is open?
The problem i have: while i am reading/writing file, some other application changes the file and its causes errors.
Currently i am reading file in such way:
ChannelSftp sftp = (ChannelSftp) session.openChannel("sftp");
InputStream stream = sftp.get("/some/file");
try {
BufferedReader br = new BufferedReader(new InputStreamReader(stream));
// read from br
} finally {
stream.close();
}