当前位置: 首页>>代码示例>>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;未经允许,请勿转载。