当前位置: 首页>>代码示例>>Java>>正文


Java FTPException类代码示例

本文整理汇总了Java中it.sauronsoftware.ftp4j.FTPException的典型用法代码示例。如果您正苦于以下问题:Java FTPException类的具体用法?Java FTPException怎么用?Java FTPException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FTPException类属于it.sauronsoftware.ftp4j包,在下文中一共展示了FTPException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listFiles

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
/**
 * Lists the files present at the specified path.
 * @param path The specified path.
 * @return The list of files.
 */
public List<FileEntity> listFiles(FtpServer server, String path) throws FTPException, IOException, FTPIllegalReplyException, FTPAbortedException, FTPDataTransferException, FTPListParseException {
    FTPClient client = this.getConnection(server);

    if(path != null && !path.equals("/")) {
        client.changeDirectory(path);
    }

    FTPFile[] list = client.list();

    List<FileEntity> results = new ArrayList<FileEntity>();

    if(list != null) {
        for (FTPFile file : list) {
            if(!file.getName().equals("..")) {
                results.add(this.ftpFileToEntity(file, path));
            }
        }
    }

    Collections.sort(results);

    return results;
}
 
开发者ID:Paul-DS,项目名称:SimpleFTP,代码行数:29,代码来源:FtpRepository.java

示例2: retrieveFile

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
/**
 * Speichert den Remote-File im OutputStream local.
 */
private static void retrieveFile (String remote, OutputStream local, FtpConnection con)
		throws IOException, FTPIllegalReplyException, FTPException, IllegalStateException,
		FTPDataTransferException, FTPAbortedException
{
	boolean conWasNull = con == null;
	if (conWasNull)
		con = cons.getClient();
	FTPClient client = con.getFtpClient();
	
	try
	{
		client.download(remote, local, 0, null);
	}
	finally
	{
		if (conWasNull)
			con.setBusy(false);
	}
	
	local.close();
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:25,代码来源:DatastoreFtpClient.java

示例3: storeFile

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
/**
 * Lädt den Inhalt des InputStreams local nach remote.
 */
private static void storeFile (String remote, InputStream local, FtpConnection con)
		throws IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException
{
	boolean conWasNull = con == null;
	if (conWasNull)
		con = cons.getClient();
	FTPClient client = con.getFtpClient();
	
	try
	{
		client.upload(remote, local, 0, 0, null);
	}
	finally
	{
		if (conWasNull)
			con.setBusy(false);
	}
	local.close();
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:23,代码来源:DatastoreFtpClient.java

示例4: fileSize

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
/**
 * Gibt die Größe der angegebenen Datei zurück.
 */
private static long fileSize (String remote, FtpConnection con)
		throws IOException, FTPIllegalReplyException, FTPException
{
	boolean conWasNull = con == null;
	if (conWasNull)
		con = cons.getClient();
	FTPClient client = con.getFtpClient();
	
	long retval;
	try
	{
		retval = client.fileSize(remote);
	}
	finally
	{
		if (conWasNull)
			con.setBusy(false);
	}
	return retval;
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:24,代码来源:DatastoreFtpClient.java

示例5: startQualifyGame

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
/**
 * Startet ein Qualifikations-Spiel des angegebenen Typs mit der
 * angegegebenen KI.
 */
public static GameImpl startQualifyGame (int gameId, int requestId, String language, String ai, String qualilang)
		throws IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException,
		ReflectiveOperationException, FTPListParseException
{
	LoadedGameLogic logic = loadGameLogic(gameId);
	UUID uuid = randomUuid();
	
	// die KIs herausfinden. QualiKI: -gameId version 1
	int numAis = logic.getGameLogic().playerAmt();
	String ais[] = new String[numAis];
	ais[0] = ai;
	for (int i = 1; i < numAis; i++)
		ais[1] = "-" + gameId + "v1";
	String[] languages = { language, qualilang };
	// Spiel starten
	GameImpl game = new GameImpl(gameId, logic.getGameLogic(), uuid, requestId, false, languages, ais);
	game.setGameFinishedListener(logic);
	synchronized (lock)
	{
		games.put(uuid, game);
	}
	return game;
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:28,代码来源:Games.java

示例6: updateGroup

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
private SyncGroup updateGroup(SyncGroup group, FtpClient client) {
    try {
        return retryableUpdateGroup(group, client);
    } catch (IllegalStateException | FTPException | IOException | FTPIllegalReplyException e) {
        log.warn("Could not update {} due to {}", group.getRemoteDir(), e.toString());
        return null;
    }
}
 
开发者ID:quanticc,项目名称:ugc-bot-redux,代码行数:9,代码来源:SyncGroupService.java

示例7: connect

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
private boolean connect(FtpClient client, Map<String, String> credentials) {
    try {
        retryableConnect(client, credentials);
        return true;
    } catch (FTPException | IOException | FTPIllegalReplyException e) {
        log.warn("Could not connect to FTP server after retrying: {}", e.toString());
        return false;
    }
}
 
开发者ID:quanticc,项目名称:ugc-bot-redux,代码行数:10,代码来源:SyncGroupService.java

示例8: deleteFiles

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
/**
 * Delete a list of files and directories.
 * @param server The FTP server.
 * @param elements The specified list.
 */
public void deleteFiles(FtpServer server, List<FileEntity> elements) throws FTPException, IOException, FTPIllegalReplyException {
    FTPClient client = this.getConnection(server);

    for (FileEntity element: elements) {
        if(element.isDirectory()) {
            client.deleteDirectory(element.getPath());
        }
        else {
            client.deleteFile(element.getPath());
        }
    }
}
 
开发者ID:Paul-DS,项目名称:SimpleFTP,代码行数:18,代码来源:FtpRepository.java

示例9: cacheLibrary

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
private void cacheLibrary (String language, String name)
		throws IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException,
		FTPListParseException
{
	File libdir = new File(cachedir, language + "/" + name);
	WorkerMain.getLogger().info("Caching Library " + name + " (" + language + ") to " + libdir.getAbsolutePath());
	libdir.mkdirs();
	DatastoreFtpClient.retrieveLibrary(name, language, libdir);
	File libtar = new File(cachedir, language + "/" + name + ".tar.bz2");
	TarArchiveOutputStream tar = new TarArchiveOutputStream(new BZip2CompressorOutputStream(new FileOutputStream(libtar)));
	tar.setBigNumberMode(BIGNUMBER_POSIX);
	tar.setLongFileMode(LONGFILE_POSIX);
	addToTar(libdir, tar, "");
	tar.close();
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:16,代码来源:LibraryCache.java

示例10: getLibDir

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
public File getLibDir (String language, String name)
		throws IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException,
		FTPListParseException
{
	File libdir = new File(cachedir, language + "/" + name);
	if (!libdir.exists())
		cacheLibrary(language, name);
	return libdir;
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:10,代码来源:LibraryCache.java

示例11: getLibTarBz2

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
public File getLibTarBz2 (String language, String name)
		throws IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException,
		FTPListParseException
{
	File libtar = new File(cachedir, language + "/" + name + ".tar.bz2");
	if (!libtar.exists())
		cacheLibrary(language, name);
	return libtar;
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:10,代码来源:LibraryCache.java

示例12: getLib

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
@Override
public File[] getLib (String language, String name)
{
	try
	{
		return getLibDir(language, name).listFiles();
	}
	catch (IOException | FTPIllegalReplyException | FTPException | FTPDataTransferException | FTPAbortedException
			| FTPListParseException e)
	{
		throw new RuntimeException(e);
	}
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:14,代码来源:LibraryCache.java

示例13: getClient

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
public FtpConnection getClient () throws IOException, FTPIllegalReplyException, FTPException
{
	while (true)
	{
		synchronized (lock)
		{
			for (int i = 0; i < cons.length; i++)
			{
				if (cons[i] == null)
				{
					new Logger().debug("Erstelle einen neuen Clienten zum FTP-Server");
					FTPClient c = new FTPClient();
					c = DatastoreFtpClient.connect(c);
					cons[i] = new FtpConnection(c);
					cons[i].setBusy(true);
					return cons[i];
				}
				
				if (!cons[i].isBusy())
				{
					cons[i].setBusy(true);
					cons[i].setFtpClient(DatastoreFtpClient.connect(cons[i].getFtpClient()));
					return cons[i];
				}
			}
			
			try
			{
				lock.wait();
			}
			catch (InterruptedException e)
			{
				e.printStackTrace();
			}
		}
	}
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:38,代码来源:FtpConnectionPool.java

示例14: retrieveDir

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
/**
 * Speichert alles im Remote-Directory im local-Verzeichnis.
 */
public static void retrieveDir (String remote, File local, FtpConnection con)
		throws IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException,
		FTPListParseException
{
	boolean conWasNull = con == null;
	if (conWasNull)
		con = cons.getClient();
	FTPClient client = con.getFtpClient();
	
	try
	{
		String cwd = client.currentDirectory();
		client.changeDirectory(remote);
		local.mkdirs();
		for (FTPFile f : client.list())
		{
			if (f.getType() == FTPFile.TYPE_FILE)
				retrieveFile(f.getName(), new File(local, f.getName()), con);
			else if (f.getType() == FTPFile.TYPE_DIRECTORY)
				retrieveDir(f.getName(), new File(local, f.getName()), con);
		}
		client.changeDirectory(cwd);
	}
	finally
	{
		if (conWasNull)
			con.setBusy(false);
	}
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:33,代码来源:DatastoreFtpClient.java

示例15: retrieveAi

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
/**
 * Speichert das tar-bzip2-Archiv mit den compilierten Daten der KI im
 * OutputStream local.
 */
public static void retrieveAi (int id, int version, OutputStream local)
		throws IllegalStateException, IOException, FTPIllegalReplyException, FTPException,
		FTPDataTransferException, FTPAbortedException
{
	retrieveFile(aiBinPath(id) + "/v" + version + ".tar.bz2", local, null);
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:11,代码来源:DatastoreFtpClient.java


注:本文中的it.sauronsoftware.ftp4j.FTPException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。