本文整理汇总了Java中com.enterprisedt.net.ftp.FTPConnectMode类的典型用法代码示例。如果您正苦于以下问题:Java FTPConnectMode类的具体用法?Java FTPConnectMode怎么用?Java FTPConnectMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FTPConnectMode类属于com.enterprisedt.net.ftp包,在下文中一共展示了FTPConnectMode类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: connect
import com.enterprisedt.net.ftp.FTPConnectMode; //导入依赖的package包/类
/**
* 登录服务器
*
* @return 返回登录结果 true成功 false失败
* @throws Exception
*/
private boolean connect() throws Exception {
boolean ret = false;
fc = new FTPClient();
try {
fc.setRemoteHost(this.ip);
fc.setRemotePort(this.port);
fc.setControlEncoding("UTF-8");
fc.connect();
fc.login(this.userName, this.pwd);
fc.setConnectMode(FTPConnectMode.ACTIVE);
fc.setType(FTPTransferType.BINARY);
ret = true;
return ret;
} catch (Exception e) {
throw new Exception("登录失败!");
}
}
开发者ID:wufeisoft,项目名称:ryf_mms2,代码行数:24,代码来源:FtpUtil.java
示例2: connect
import com.enterprisedt.net.ftp.FTPConnectMode; //导入依赖的package包/类
public void connect() throws FTPException, IOException{
ftp = new FileTransferClient();
ftp.setRemoteHost(remoteHost);
ftp.setRemotePort(remotePort);
ftp.setUserName(username);
ftp.setPassword(password);
ftp.getAdvancedFTPSettings().setConnectMode(FTPConnectMode.PASV);
ftp.connect();
}
开发者ID:knowpd,项目名称:p2p-file-sharing-system,代码行数:11,代码来源:PeerlessFtpClientSupport.java
示例3: FTPConnect
import com.enterprisedt.net.ftp.FTPConnectMode; //导入依赖的package包/类
private void FTPConnect(LogWriter log,String realServername,String realusername, String realpassword,
int realport,String realFtpDirectory, String realProxyhost,String realproxyusername,
String realproxypassword,int realproxyport,
int realtimeout) throws Exception
{
// Create ftp client to host:port ...
ftpclient = new FTPClient();
ftpclient.setRemoteAddr(InetAddress.getByName(realServername));
if(realport!=0) ftpclient.setRemotePort(realport);
if (!Const.isEmpty(realProxyhost))
{
ftpclient.setRemoteAddr(InetAddress.getByName(realProxyhost));
if ( log.isDetailed() )
log.logDetailed(toString(), Messages.getString("JobEntryFTPDelete.OpenedProxyConnectionOn",realProxyhost));
// FIXME: Proper default port for proxy
if (realproxyport != 0)
{
ftpclient.setRemotePort(realproxyport);
}
}
else
{
ftpclient.setRemoteAddr(InetAddress.getByName(realServername));
if ( log.isDetailed() )
log.logDetailed(toString(), Messages.getString("JobEntryFTPDelete.OpenedConnectionTo",realServername));
}
// set activeConnection connectmode ...
if (activeConnection)
{
ftpclient.setConnectMode(FTPConnectMode.ACTIVE);
if(log.isDetailed()) log.logDetailed(toString(), Messages.getString("JobEntryFTPDelete.SetActive")); //$NON-NLS-1$
}
else
{
ftpclient.setConnectMode(FTPConnectMode.PASV);
if(log.isDetailed()) log.logDetailed(toString(), Messages.getString("JobEntryFTPDelete.SetPassive")); //$NON-NLS-1$
}
// Set the timeout
ftpclient.setTimeout(realtimeout);
if(log.isDetailed()) log.logDetailed(toString(), Messages.getString("JobEntryFTPDelete.SetTimeout", String.valueOf(realtimeout))); //$NON-NLS-1$
// login to ftp host ...
ftpclient.connect();
String realUsername = realusername +
(!Const.isEmpty(realProxyhost) ? "@" + realServername : "") +
(!Const.isEmpty(realproxyusername) ? " " + realproxyusername
: "");
String realPassword = realpassword +
(!Const.isEmpty(realproxypassword) ? " " + realproxypassword : "" );
ftpclient.login(realUsername, realPassword);
// Remove password from logging, you don't know where it ends up.
if(log.isDetailed()) log.logDetailed(toString(), Messages.getString("JobEntryFTPDelete.LoggedIn", realUsername)); //$NON-NLS-1$
// move to spool dir ...
if (!Const.isEmpty(realFtpDirectory))
{
ftpclient.chdir(realFtpDirectory);
if(log.isDetailed()) log.logDetailed(toString(), Messages.getString("JobEntryFTPDelete.ChangedDir", realFtpDirectory)); //$NON-NLS-1$
}
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:75,代码来源:JobEntryFTPDelete.java
示例4: FTPConnect
import com.enterprisedt.net.ftp.FTPConnectMode; //导入依赖的package包/类
private void FTPConnect(String realServername,String realusername, String realpassword,
int realport,String realFtpDirectory, String realProxyhost,String realproxyusername,
String realproxypassword,int realproxyport,
int realtimeout) throws Exception
{
// Create ftp client to host:port ...
ftpclient = new FTPClient();
ftpclient.setRemoteAddr(InetAddress.getByName(realServername));
if(realport!=0) ftpclient.setRemotePort(realport);
if (!Const.isEmpty(realProxyhost))
{
ftpclient.setRemoteAddr(InetAddress.getByName(realProxyhost));
if ( isDetailed() )
logDetailed(BaseMessages.getString(PKG, "JobEntryFTPDelete.OpenedProxyConnectionOn",realProxyhost));
// FIXME: Proper default port for proxy
if (realproxyport != 0)
{
ftpclient.setRemotePort(realproxyport);
}
}
else
{
ftpclient.setRemoteAddr(InetAddress.getByName(realServername));
if ( isDetailed() )
logDetailed(BaseMessages.getString(PKG, "JobEntryFTPDelete.OpenedConnectionTo",realServername));
}
// set activeConnection connectmode ...
if (activeConnection)
{
ftpclient.setConnectMode(FTPConnectMode.ACTIVE);
if(isDetailed()) logDetailed(BaseMessages.getString(PKG, "JobEntryFTPDelete.SetActive")); //$NON-NLS-1$
}
else
{
ftpclient.setConnectMode(FTPConnectMode.PASV);
if(isDetailed()) logDetailed(BaseMessages.getString(PKG, "JobEntryFTPDelete.SetPassive")); //$NON-NLS-1$
}
// Set the timeout
ftpclient.setTimeout(realtimeout);
if(isDetailed()) logDetailed(BaseMessages.getString(PKG, "JobEntryFTPDelete.SetTimeout", String.valueOf(realtimeout))); //$NON-NLS-1$
// login to ftp host ...
ftpclient.connect();
String realUsername = realusername +
(!Const.isEmpty(realProxyhost) ? "@" + realServername : "") +
(!Const.isEmpty(realproxyusername) ? " " + realproxyusername
: "");
String realPassword = realpassword +
(!Const.isEmpty(realproxypassword) ? " " + realproxypassword : "" );
ftpclient.login(realUsername, realPassword);
// Remove password from logging, you don't know where it ends up.
if(isDetailed()) logDetailed(BaseMessages.getString(PKG, "JobEntryFTPDelete.LoggedIn", realUsername)); //$NON-NLS-1$
// move to spool dir ...
if (!Const.isEmpty(realFtpDirectory))
{
ftpclient.chdir(realFtpDirectory);
if(isDetailed()) logDetailed(BaseMessages.getString(PKG, "JobEntryFTPDelete.ChangedDir", realFtpDirectory)); //$NON-NLS-1$
}
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:75,代码来源:JobEntryFTPDelete.java
示例5: FTPConnect
import com.enterprisedt.net.ftp.FTPConnectMode; //导入依赖的package包/类
private void FTPConnect( String realServername, String realusername, String realpassword, int realport,
String realFtpDirectory, String realProxyhost, String realproxyusername, String realproxypassword,
int realproxyport, int realtimeout ) throws Exception {
// Create ftp client to host:port ...
ftpclient = new FTPClient();
ftpclient.setRemoteAddr( InetAddress.getByName( realServername ) );
if ( realport != 0 ) {
ftpclient.setRemotePort( realport );
}
if ( !Utils.isEmpty( realProxyhost ) ) {
ftpclient.setRemoteAddr( InetAddress.getByName( realProxyhost ) );
if ( isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobEntryFTPDelete.OpenedProxyConnectionOn", realProxyhost ) );
}
// FIXME: Proper default port for proxy
if ( realproxyport != 0 ) {
ftpclient.setRemotePort( realproxyport );
}
} else {
ftpclient.setRemoteAddr( InetAddress.getByName( realServername ) );
if ( isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobEntryFTPDelete.OpenedConnectionTo", realServername ) );
}
}
// set activeConnection connectmode ...
if ( activeConnection ) {
ftpclient.setConnectMode( FTPConnectMode.ACTIVE );
if ( isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobEntryFTPDelete.SetActive" ) );
}
} else {
ftpclient.setConnectMode( FTPConnectMode.PASV );
if ( isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobEntryFTPDelete.SetPassive" ) );
}
}
// Set the timeout
ftpclient.setTimeout( realtimeout );
if ( isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobEntryFTPDelete.SetTimeout", String.valueOf( realtimeout ) ) );
}
// login to ftp host ...
ftpclient.connect();
String realUsername =
realusername
+ ( !Utils.isEmpty( realProxyhost ) ? "@" + realServername : "" )
+ ( !Utils.isEmpty( realproxyusername ) ? " " + realproxyusername : "" );
String realPassword = realpassword + ( !Utils.isEmpty( realproxypassword ) ? " " + realproxypassword : "" );
ftpclient.login( realUsername, realPassword );
// Remove password from logging, you don't know where it ends up.
if ( isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobEntryFTPDelete.LoggedIn", realUsername ) );
}
// move to spool dir ...
if ( !Utils.isEmpty( realFtpDirectory ) ) {
ftpclient.chdir( realFtpDirectory );
if ( isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobEntryFTPDelete.ChangedDir", realFtpDirectory ) );
}
}
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:74,代码来源:JobEntryFTPDelete.java
示例6: createAndSetUpFtpClient
import com.enterprisedt.net.ftp.FTPConnectMode; //导入依赖的package包/类
FTPClient createAndSetUpFtpClient() throws IOException, FTPException {
String realServerName = environmentSubstitute( serverName );
String realServerPort = environmentSubstitute( serverPort );
FTPClient ftpClient = createFtpClient();
ftpClient.setRemoteAddr( InetAddress.getByName( realServerName ) );
if ( !Utils.isEmpty( realServerPort ) ) {
ftpClient.setRemotePort( Const.toInt( realServerPort, FTP_DEFAULT_PORT ) );
}
if ( !Utils.isEmpty( proxyHost ) ) {
String realProxyHost = environmentSubstitute( proxyHost );
ftpClient.setRemoteAddr( InetAddress.getByName( realProxyHost ) );
if ( log.isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobEntryFTPPUT.OpenedProxyConnectionOn", realProxyHost ) );
}
// FIXME: Proper default port for proxy
int port = Const.toInt( environmentSubstitute( proxyPort ), FTP_DEFAULT_PORT );
if ( port != 0 ) {
ftpClient.setRemotePort( port );
}
} else {
if ( log.isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobEntryFTPPUT.OpenConnection", realServerName ) );
}
}
// set activeConnection connectmode ...
if ( activeConnection ) {
ftpClient.setConnectMode( FTPConnectMode.ACTIVE );
if ( log.isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobFTPPUT.Log.SetActiveConnection" ) );
}
} else {
ftpClient.setConnectMode( FTPConnectMode.PASV );
if ( log.isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobFTPPUT.Log.SetPassiveConnection" ) );
}
}
// Set the timeout
if ( timeout > 0 ) {
ftpClient.setTimeout( timeout );
if ( log.isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobFTPPUT.Log.SetTimeout", "" + timeout ) );
}
}
ftpClient.setControlEncoding( controlEncoding );
if ( log.isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobFTPPUT.Log.SetEncoding", controlEncoding ) );
}
// If socks proxy server was provided
if ( !Utils.isEmpty( socksProxyHost ) ) {
// if a port was provided
if ( !Utils.isEmpty( socksProxyPort ) ) {
FTPClient.initSOCKS( environmentSubstitute( socksProxyPort ), environmentSubstitute( socksProxyHost ) );
} else { // looks like we have a host and no port
throw new FTPException( BaseMessages.getString(
PKG, "JobFTPPUT.SocksProxy.PortMissingException", environmentSubstitute( socksProxyHost ) ) );
}
// now if we have authentication information
if ( !Utils.isEmpty( socksProxyUsername )
&& Utils.isEmpty( socksProxyPassword ) || Utils.isEmpty( socksProxyUsername )
&& !Utils.isEmpty( socksProxyPassword ) ) {
// we have a username without a password or vica versa
throw new FTPException( BaseMessages.getString(
PKG, "JobFTPPUT.SocksProxy.IncompleteCredentials", environmentSubstitute( socksProxyHost ),
getName() ) );
}
}
return ftpClient;
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:77,代码来源:JobEntryFTPPUT.java
注:本文中的com.enterprisedt.net.ftp.FTPConnectMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论