我正在尝试将byteArrayInputStream作为File存储在FTP Server上。我已经可以连接到服务器并更改工作路径,但是触发将流作为文件存储在服务器上的方法总是返回false。
我正在使用 apache FTPClient。
有人可以给我一个提示我的错误可能在哪里!?
这里的代码:
String filename = "xyz.xml"
// connection returns true
connectToFtpServer(ftpHost, ftpUser, ftpPassword, exportDirectory);
// byteArray is not void
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
try {
// change returns true
result = ftpClient.changeWorkingDirectory(exportDirectory);
// storing the file returns false
result = ftpClient.storeFile(filename, byteArrayInputStream);
byteArrayInputStream.close();
ftpClient.logout();
} catch (...) {
...
} finally {
// disconnect returns true
disconnectFromFtpServer();
}