• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FTPException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: retrieveAiSource

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
/**
 * Speichert alle Dateien im Source-Folder der KI in einem temporären
 * Verzeichnis und gibt dieses zurück.
 */
public static File retrieveAiSource (int id, int version)
		throws IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException,
		FTPListParseException
{
	File tmp = Files.createTempDirectory("ai").toFile();
	retrieveDir(aiSourcePath(id, version), tmp, null);
	return tmp;
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:13,代码来源:DatastoreFtpClient.java


示例17: retrieveAiLibrary

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
/**
 * Speichert die AiLibrary der angegebenen Sprache im Verzeichnis local.
 */
public static void retrieveAiLibrary (int game, String language, File local)
		throws IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException,
		FTPListParseException
{
	retrieveDir("Games/" + game + "/" + language + "/ailib", local, null);
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:10,代码来源:DatastoreFtpClient.java


示例18: retrieveLibrary

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
/**
 * Speichert die jar-Archive der Bibliothek im Verzeichnis local.
 */
public static void retrieveLibrary (String lib, String language, File local)
		throws IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException,
		FTPListParseException
{
	retrieveDir("Libraries/" + language + "/" + lib, local, null);
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:10,代码来源:DatastoreFtpClient.java


示例19: retrieveTournamentAis

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
/**
 * Lädt die KIs des Turniers herunter.
 */
public static String retrieveTournamentAis (int id)
		throws IOException, FTPIllegalReplyException, FTPException, IllegalStateException,
		FTPDataTransferException, FTPAbortedException
{
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	retrieveFile("Tournaments/" + id + "/ais.json", baos, null);
	return new String(baos.toByteArray(), UTF_8);
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:12,代码来源:DatastoreFtpClient.java


示例20: loadGameLogic

import it.sauronsoftware.ftp4j.FTPException; //导入依赖的package包/类
/**
 * Lädt die Jar-Datei der GameLogic für das angegebene Spiel herunter,
 * liest die Manifest-Datei, und lädt die GameLogic-Klasse.
 */
public static LoadedGameLogic loadGameLogic (int gameId) // keep in sync
															// with codr
		throws IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException,
		ReflectiveOperationException, FTPListParseException
{
	// jar runterladen
	File jar = Files.createTempFile("logic", ".jar").toFile();
	DatastoreFtpClient.retrieveGameLogic(gameId, jar);
	
	// manifest lesen
	JarFile jarFile = new JarFile(jar);
	Manifest mf = jarFile.getManifest();
	String classname = mf.getMainAttributes().getValue("Logic-Class");
	BackendMain.getLogger().info("Lade Logik-Klasse " + classname);
	String requiredLibs[] = mf.getMainAttributes().getValue("Required-Libs").split("\\s+");
	File libDir = Files.createTempDirectory("libs").toFile();
	for (String lib : requiredLibs)
		if (!lib.isEmpty())
			DatastoreFtpClient.retrieveLibrary(lib, "Java", libDir);
	jarFile.close();
	
	// klasse laden
	List<URL> urls = new ArrayList<>();
	urls.add(jar.toURI().toURL());
	for (File entry : libDir.listFiles())
		urls.add(entry.toURI().toURL());
	URLClassLoader cl = new URLClassLoader(urls.toArray(new URL[0]));
	Class<?> clazz = cl.loadClass(classname);
	LoadedGameLogic logic = new LoadedGameLogic((GameLogic<?, ?>)clazz.newInstance(), cl);
	logic.getToDelete().add(jar);
	logic.getToDelete().add(libDir);
	return logic;
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:38,代码来源:Games.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EventHandler类代码示例发布时间:2022-05-22
下一篇:
Java PomNamedTarget类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap