apache FTP操作,获取InputStream

具体可参考FileAction里面的封装:

FTPClient fc = new FTPClient();

fc.connect(path,url);

fc.login(username,password;

fc.enterLocalPassiveMode();

fc.setFileType(FTPClient.BINARY_FILE_TYPE);

 

int reply = fc.getReplyCode();

if (!FTPReply.isPositiveCompletion(reply)) {

fc.disconnect();

return;

}

fc.changeWorkingDirectory(path);

//xlsInputStream  = fc.getInputStream(); //这个方式获取不到

xlsInputStream = fc.retrieveFileStream(path);

fc.disconnect();

你可能感兴趣的:(java,apache,ftp)