Handle p = handles.get(handle);
if (!(p instanceof FileHandle)) {
sendStatus(id, SSH_FX_INVALID_HANDLE, handle);
} else {
SshFile sshFile = ((FileHandle) p).getFile();
OutputStream os = sshFile.createOutputStream(offset);
try {
os.write(data); // TODO: handle append flags
} finally {
if (os != null) {