String unixPath = "target/scp/out.txt";
File target = new File(unixPath);
root.mkdirs();
assertTrue(root.exists());
ChannelSftp c = (ChannelSftp) session.openChannel("sftp");
c.connect();
c.put(new ByteArrayInputStream("0123456789".getBytes()), unixPath);
assertTrue(target.exists());
assertEquals("0123456789", readFile(unixPath));
OutputStream os = c.put(unixPath, null, ChannelSftp.APPEND, -5);
os.write("a".getBytes());
os.close();
c.disconnect();
assertTrue(target.exists());
assertEquals("01234a", readFile(unixPath));
target.delete();