本文整理汇总了Java中sun.net.ftp.FtpClient类的典型用法代码示例。如果您正苦于以下问题:Java FtpClient类的具体用法?Java FtpClient怎么用?Java FtpClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FtpClient类属于sun.net.ftp包,在下文中一共展示了FtpClient类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import sun.net.ftp.FtpClient; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
try (FtpServer server = new FtpServer();
FtpClient client = FtpClient.create()) {
(new Thread(server)).start();
int port = server.getPort();
client.connect(new InetSocketAddress("localhost", port));
client.nameList(null);
} finally {
if (commandHasArgs) {
throw new RuntimeException("Test failed. NLST shouldn't have " +
"args if nameList parameter is null");
}
}
}
示例2: getPermission
import sun.net.ftp.FtpClient; //导入依赖的package包/类
/**
* Gets the <code>Permission</code> associated with the host & port.
*
* @return The <code>Permission</code> object.
*/
@Override
public Permission getPermission() {
if (permission == null) {
int urlport = url.getPort();
urlport = urlport < 0 ? FtpClient.defaultPort() : urlport;
String urlhost = this.host + ":" + urlport;
permission = new SocketPermission(urlhost, "connect");
}
return permission;
}
示例3: FtpInputStream
import sun.net.ftp.FtpClient; //导入依赖的package包/类
FtpInputStream(FtpClient cl, InputStream fd) {
super(new BufferedInputStream(fd));
ftp = cl;
}
示例4: FtpOutputStream
import sun.net.ftp.FtpClient; //导入依赖的package包/类
FtpOutputStream(FtpClient cl, OutputStream fd) {
super(fd);
ftp = cl;
}