私はGanymed APIを使用してUnixサーバーにsftp接続しています。私はサーバーにファイルを作成することができますが、ファイルの内容は常に空です。Ganymed API:SFTPを使用して
GanymedのAPIの場所: http://www.ganymed.ethz.ch/ssh2/
コード:
function (ByteArrayOutputStream reportBytes){
// reportBytes is a valid ByteArrayOutputStream
// if I write it to a file in to a local directory using reportBytes.writeTo(fout);
// I can see the contents */
byte byteArray[]=reportBytes.toByteArray();
SFTPv3FileHandle SFTPFILEHandle=sftpClient.createFileTruncate("test.txt");
//The file is created successfully and it is listed in unix
// The permissions of the file -rw-r--r-- 1 test.txt
sftpClient.write(SFTPFILEHandle, 0, byteArray, 0,byteArray.length);
//The above line doesnt seem to work, the file is always empty
}
/* write function definition is */
public void write(SFTPv3FileHandle handle, long fileOffset, byte[] src, int srcoff, int len) throws IOException
私はここに
はあなたが別のSFTPクライアントとのことをテストすることによって、このサーバーにファイルをアップロードできることを確認したことがありますか?多分あなたのアカウントにはファイルを作成する権限はありますが、書き込むことはできません。 – gutch