本文整理汇总了Java中com.enterprisedt.net.ftp.FTPException类的典型用法代码示例。如果您正苦于以下问题:Java FTPException类的具体用法?Java FTPException怎么用?Java FTPException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FTPException类属于com.enterprisedt.net.ftp包,在下文中一共展示了FTPException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import com.enterprisedt.net.ftp.FTPException; //导入依赖的package包/类
@Override
public void get( String arg0, String arg1 ) throws IOException, FTPException {
FileWriter fw = null;
try {
Random r = new Random();
fw = new FileWriter( arg0 );
for ( int i = 0; i < 100; i++ ) {
fw.append( (char) ( r.nextInt( 83 ) + 32 ) );
}
fw.flush();
fw.close();
} finally {
if ( fw != null ) {
fw.close();
}
}
}
示例2: connect
import com.enterprisedt.net.ftp.FTPException; //导入依赖的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();
}
示例3: dirDetails
import com.enterprisedt.net.ftp.FTPException; //导入依赖的package包/类
@Override
public FTPFile[] dirDetails( String arg0 ) throws IOException, FTPException, ParseException {
FTPFile[] files = new FTPFile[10];
for ( int i = 0; i < files.length - 1; i++ ) {
files[i] = new FTPFile( "file_" + i, "file_" + i, 100, false, new Date() );
}
files[files.length - 1] = new FTPFile( "robots.txt", "robots.txt", 100, false, new Date() );
return files;
}
示例4: hookInOtherParsers
import com.enterprisedt.net.ftp.FTPException; //导入依赖的package包/类
/**
* Hook in known parsers, and then those that have been specified in the variable
* ftp.file.parser.class.names
* @param ftpClient
* @throws FTPException
* @throws IOException
*/
protected void hookInOtherParsers(FTPClient ftpClient) throws FTPException, IOException {
if (log.isDebug()) {logDebug(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Hooking.Parsers"));}
String system = ftpClient.system();
MVSFileParser parser = new MVSFileParser();
if (log.isDebug()) {logDebug(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Created.MVS.Parser"));}
FTPFileFactory factory = new FTPFileFactory(system);
if (log.isDebug()) {logDebug(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Created.Factory"));}
factory.addParser(parser);
ftpClient.setFTPFileFactory(factory);
if (log.isDebug()) {logDebug(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Get.Variable.Space"));}
VariableSpace vs = this.getVariables();
if (vs != null) {
if (log.isDebug()) {logDebug(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Getting.Other.Parsers"));}
String otherParserNames = vs.getVariable("ftp.file.parser.class.names");
if (otherParserNames != null) {
if (log.isDebug()) {logDebug(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Creating.Parsers"));}
String[] parserClasses = otherParserNames.split("|");
String cName = null;
Class<?> clazz = null;
Object parserInstance = null;
for (int i=0; i<parserClasses.length; i++) {
cName = parserClasses[i].trim();
if (cName.length() > 0) {
try {
clazz = Class.forName(cName);
parserInstance = clazz.newInstance();
if (parserInstance instanceof FTPFileParser) {
if (log.isDetailed()) {logDetailed(BaseMessages.getString(PKG, "JobEntryFTP.DEBUG.Created.Other.Parser", cName));}
factory.addParser((FTPFileParser)parserInstance);
}
} catch (Exception ignored) {
if (log.isDebug()) {
ignored.printStackTrace();
logError(BaseMessages.getString(PKG, "JobEntryFTP.ERROR.Creating.Parser", cName));
}
}
}
}
}
}
}
示例5: uploadFile
import com.enterprisedt.net.ftp.FTPException; //导入依赖的package包/类
public String uploadFile(String localFileName, String remoteFileName) throws FTPException, IOException{
return ftp.uploadFile(localFileName, remoteFileName);
}
示例6: downloadFile
import com.enterprisedt.net.ftp.FTPException; //导入依赖的package包/类
public void downloadFile(String localFileName, String remoteFileName) throws FTPException, IOException{
ftp.downloadFile(localFileName, remoteFileName);
}
示例7: hookInOtherParsers
import com.enterprisedt.net.ftp.FTPException; //导入依赖的package包/类
/**
* Hook in known parsers, and then those that have been specified in the variable ftp.file.parser.class.names
*
* @param ftpClient
* @throws FTPException
* @throws IOException
*/
protected void hookInOtherParsers( FTPClient ftpClient ) throws FTPException, IOException {
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Hooking.Parsers" ) );
}
String system = ftpClient.system();
MVSFileParser parser = new MVSFileParser( log );
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Created.MVS.Parser" ) );
}
FTPFileFactory factory = new FTPFileFactory( system );
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Created.Factory" ) );
}
factory.addParser( parser );
ftpClient.setFTPFileFactory( factory );
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Get.Variable.Space" ) );
}
VariableSpace vs = this.getVariables();
if ( vs != null ) {
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Getting.Other.Parsers" ) );
}
String otherParserNames = vs.getVariable( "ftp.file.parser.class.names" );
if ( otherParserNames != null ) {
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Creating.Parsers" ) );
}
String[] parserClasses = otherParserNames.split( "|" );
String cName = null;
Class<?> clazz = null;
Object parserInstance = null;
for ( int i = 0; i < parserClasses.length; i++ ) {
cName = parserClasses[i].trim();
if ( cName.length() > 0 ) {
try {
clazz = Class.forName( cName );
parserInstance = clazz.newInstance();
if ( parserInstance instanceof FTPFileParser ) {
if ( log.isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Created.Other.Parser", cName ) );
}
factory.addParser( (FTPFileParser) parserInstance );
}
} catch ( Exception ignored ) {
if ( log.isDebug() ) {
ignored.printStackTrace();
logError( BaseMessages.getString( PKG, "JobEntryFTP.ERROR.Creating.Parser", cName ) );
}
}
}
}
}
}
}
示例8: createAndSetUpFtpClient
import com.enterprisedt.net.ftp.FTPException; //导入依赖的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;
}
示例9: hookInOtherParsers
import com.enterprisedt.net.ftp.FTPException; //导入依赖的package包/类
/**
* Hook in known parsers, and then those that have been specified in the variable ftp.file.parser.class.names
*
* @param ftpClient
* @throws FTPException
* @throws IOException
*/
protected void hookInOtherParsers( FTPClient ftpClient ) throws FTPException, IOException {
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Hooking.Parsers" ) );
}
String system = ftpClient.system();
MVSFileParser parser = new MVSFileParser( log );
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Created.MVS.Parser" ) );
}
FTPFileFactory factory = new FTPFileFactory( system );
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Created.Factory" ) );
}
factory.addParser( parser );
ftpClient.setFTPFileFactory( factory );
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Get.Variable.Space" ) );
}
VariableSpace vs = this.getVariables();
if ( vs != null ) {
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Getting.Other.Parsers" ) );
}
String otherParserNames = vs.getVariable( "ftp.file.parser.class.names" );
if ( otherParserNames != null ) {
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Creating.Parsers" ) );
}
String[] parserClasses = otherParserNames.split( "|" );
String cName = null;
Class<?> clazz = null;
Object parserInstance = null;
for ( int i = 0; i < parserClasses.length; i++ ) {
cName = parserClasses[ i ].trim();
if ( cName.length() > 0 ) {
try {
clazz = Class.forName( cName );
parserInstance = clazz.newInstance();
if ( parserInstance instanceof FTPFileParser ) {
if ( log.isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JobEntryFTP.DEBUG.Created.Other.Parser", cName ) );
}
factory.addParser( (FTPFileParser) parserInstance );
}
} catch ( Exception ignored ) {
if ( log.isDebug() ) {
ignored.printStackTrace();
logError( BaseMessages.getString( PKG, "JobEntryFTP.ERROR.Creating.Parser", cName ) );
}
}
}
}
}
}
}
示例10: connect
import com.enterprisedt.net.ftp.FTPException; //导入依赖的package包/类
@Override
public void connect() throws IOException, FTPException {
connected = true;
}
示例11: delete
import com.enterprisedt.net.ftp.FTPException; //导入依赖的package包/类
@Override
public void delete( String remoteFile ) throws IOException, FTPException {
}
示例12: login
import com.enterprisedt.net.ftp.FTPException; //导入依赖的package包/类
@Override
public void login( String user, String password, String accountInfo ) throws IOException, FTPException {
}
示例13: mkdir
import com.enterprisedt.net.ftp.FTPException; //导入依赖的package包/类
@Override
public void mkdir( String dir ) throws IOException, FTPException {
}
示例14: quit
import com.enterprisedt.net.ftp.FTPException; //导入依赖的package包/类
@Override
public void quit() throws IOException, FTPException {
}
示例15: setRemoteHost
import com.enterprisedt.net.ftp.FTPException; //导入依赖的package包/类
@Override
public void setRemoteHost( String remoteHost ) throws IOException, FTPException {
}