當前位置: 首頁>>代碼示例>>Java>>正文


Java FTP.DEFAULT_PORT屬性代碼示例

本文整理匯總了Java中org.apache.commons.net.ftp.FTP.DEFAULT_PORT屬性的典型用法代碼示例。如果您正苦於以下問題:Java FTP.DEFAULT_PORT屬性的具體用法?Java FTP.DEFAULT_PORT怎麽用?Java FTP.DEFAULT_PORT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.commons.net.ftp.FTP的用法示例。


在下文中一共展示了FTP.DEFAULT_PORT屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initialize

@Override
public void initialize(URI uri, Configuration conf) throws IOException { // get
  super.initialize(uri, conf);
  // get host information from uri (overrides info in conf)
  String host = uri.getHost();
  host = (host == null) ? conf.get(FS_FTP_HOST, null) : host;
  if (host == null) {
    throw new IOException("Invalid host specified");
  }
  conf.set(FS_FTP_HOST, host);

  // get port information from uri, (overrides info in conf)
  int port = uri.getPort();
  port = (port == -1) ? FTP.DEFAULT_PORT : port;
  conf.setInt("fs.ftp.host.port", port);

  // get user/password information from URI (overrides info in conf)
  String userAndPassword = uri.getUserInfo();
  if (userAndPassword == null) {
    userAndPassword = (conf.get("fs.ftp.user." + host, null) + ":" + conf
        .get("fs.ftp.password." + host, null));
  }
  String[] userPasswdInfo = userAndPassword.split(":");
  Preconditions.checkState(userPasswdInfo.length > 1,
                           "Invalid username / password");
  conf.set(FS_FTP_USER_PREFIX + host, userPasswdInfo[0]);
  conf.set(FS_FTP_PASSWORD_PREFIX + host, userPasswdInfo[1]);
  setConf(conf);
  this.uri = uri;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:30,代碼來源:FTPFileSystem.java

示例2: initialize

@Override
public void initialize(URI uri, Configuration conf) throws IOException { // get
  super.initialize(uri, conf);
  // get host information from uri (overrides info in conf)
  String host = uri.getHost();
  host = (host == null) ? conf.get(FS_FTP_HOST, null) : host;
  if (host == null) {
    throw new IOException("Invalid host specified");
  }
  conf.set(FS_FTP_HOST, host);

  // get port information from uri, (overrides info in conf)
  int port = uri.getPort();
  port = (port == -1) ? FTP.DEFAULT_PORT : port;
  conf.setInt("fs.ftp.host.port", port);

  // get user/password information from URI (overrides info in conf)
  String userAndPassword = uri.getUserInfo();
  if (userAndPassword == null) {
    userAndPassword = (conf.get("fs.ftp.user." + host, null) + ":" + conf
        .get("fs.ftp.password." + host, null));
    if (userAndPassword == null) {
      throw new IOException("Invalid user/passsword specified");
    }
  }
  String[] userPasswdInfo = userAndPassword.split(":");
  conf.set(FS_FTP_USER_PREFIX + host, userPasswdInfo[0]);
  if (userPasswdInfo.length > 1) {
    conf.set(FS_FTP_PASSWORD_PREFIX + host, userPasswdInfo[1]);
  } else {
    conf.set(FS_FTP_PASSWORD_PREFIX + host, null);
  }
  setConf(conf);
  this.uri = uri;
}
 
開發者ID:Nextzero,項目名稱:hadoop-2.6.0-cdh5.4.3,代碼行數:35,代碼來源:FTPFileSystem.java

示例3: initialize

@Override
public void initialize(URI uri, Configuration conf) throws IOException { // get
  super.initialize(uri, conf);
  // get host information from uri (overrides info in conf)
  String host = uri.getHost();
  host = (host == null) ? conf.get("fs.ftp.host", null) : host;
  if (host == null) {
    throw new IOException("Invalid host specified");
  }
  conf.set("fs.ftp.host", host);

  // get port information from uri, (overrides info in conf)
  int port = uri.getPort();
  port = (port == -1) ? FTP.DEFAULT_PORT : port;
  conf.setInt("fs.ftp.host.port", port);

  // get user/password information from URI (overrides info in conf)
  String userAndPassword = uri.getUserInfo();
  if (userAndPassword == null) {
    userAndPassword = (conf.get("fs.ftp.user." + host, null) + ":" + conf
        .get("fs.ftp.password." + host, null));
    if (userAndPassword == null) {
      throw new IOException("Invalid user/passsword specified");
    }
  }
  String[] userPasswdInfo = userAndPassword.split(":");
  conf.set("fs.ftp.user." + host, userPasswdInfo[0]);
  if (userPasswdInfo.length > 1) {
    conf.set("fs.ftp.password." + host, userPasswdInfo[1]);
  } else {
    conf.set("fs.ftp.password." + host, null);
  }
  setConf(conf);
  this.uri = uri;
}
 
開發者ID:rhli,項目名稱:hadoop-EAR,代碼行數:35,代碼來源:FTPFileSystem.java

示例4: AbstractFTPInputOperator

public AbstractFTPInputOperator()
{
  super();
  port = FTP.DEFAULT_PORT;
  userName = "anonymous";
  password = "guest";
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:7,代碼來源:AbstractFTPInputOperator.java

示例5: initialize

@Override
public void initialize(URI uri, Configuration conf) throws IOException { // get
  super.initialize(uri, conf);
  // get host information from uri (overrides info in conf)
  String host = uri.getHost();
  host = (host == null) ? conf.get(FS_FTP_HOST, null) : host;
  if (host == null) {
    throw new IOException("Invalid host specified");
  }
  conf.set(FS_FTP_HOST, host);

  // get port information from uri, (overrides info in conf)
  int port = uri.getPort();
  port = (port == -1) ? FTP.DEFAULT_PORT : port;
  conf.setInt(FS_FTP_HOST_PORT, port);

  // get user/password information from URI (overrides info in conf)
  String userAndPassword = uri.getUserInfo();
  if (userAndPassword == null) {
    userAndPassword = (conf.get(FS_FTP_USER_PREFIX + host, null) + ":" + conf
        .get(FS_FTP_PASSWORD_PREFIX + host, null));
  }
  String[] userPasswdInfo = userAndPassword.split(":");
  Preconditions.checkState(userPasswdInfo.length > 1,
                           "Invalid username / password");
  conf.set(FS_FTP_USER_PREFIX + host, userPasswdInfo[0]);
  conf.set(FS_FTP_PASSWORD_PREFIX + host, userPasswdInfo[1]);
  setConf(conf);
  this.uri = uri;
}
 
開發者ID:hopshadoop,項目名稱:hops,代碼行數:30,代碼來源:FTPFileSystem.java

示例6: getUriDefaultPort

@Override
public int getUriDefaultPort() {
  return FTP.DEFAULT_PORT;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:4,代碼來源:FtpFs.java

示例7: getDefaultPort

/**
 * Get the default port for this FTPFileSystem.
 *
 * @return the default port
 */
@Override
protected int getDefaultPort() {
  return FTP.DEFAULT_PORT;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:9,代碼來源:FTPFileSystem.java


注:本文中的org.apache.commons.net.ftp.FTP.DEFAULT_PORT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。