下面列出了怎么用org.apache.hadoop.fs.ftp.FTPFileSystem的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
protected FileSystem getFSInstance() throws IOException
{
FTPFileSystem ftpFileSystem = new FTPFileSystem();
String ftpUri = "ftp://" + userName + ":" + password + "@" + host + ":" + port;
LOG.debug("ftp uri {}", ftpUri);
ftpFileSystem.initialize(URI.create(ftpUri), configuration);
return ftpFileSystem;
}
/**
* Check the exception was about cross-directory renames
* -if not, rethrow it.
* @param e exception raised
* @throws IOException
*/
private void verifyUnsupportedDirRenameException(IOException e) throws IOException {
if (!e.toString().contains(FTPFileSystem.E_SAME_DIRECTORY_ONLY)) {
throw e;
}
}
/**
* Check the exception was about cross-directory renames
* -if not, rethrow it.
* @param e exception raised
* @throws IOException
*/
private void verifyUnsupportedDirRenameException(IOException e) throws IOException {
if (!e.toString().contains(FTPFileSystem.E_SAME_DIRECTORY_ONLY)) {
throw e;
}
}