我是使用 Apache Common vfs 的新手,我成功连接到我已经阅读过文档的服务器,但我被困在这段代码中。我如何列出目录/文件?
....
Session session = null;
FileSystemManager fsManager = null;
FileSystem fs = null;
try {
String host = "host_here";
int port = 22;
String userStr = "user_here";
char [] username = userStr.toCharArray();
String passStr = "password_here";
char [] password = passStr.toCharArray();
session = SftpClientFactory.createConnection(host, port, username, password, null);
//session.connect();
System.out.println("Connected to the server");
FileSystemOptions opts = new FileSystemOptions();
fsManager = VFS.getManager();
FileObject file = fsManager.resolveFile("ftp://"+userStr+":"+passStr+"@"+host+"/home/", opts);
// .... whats next i do here? .....
} catch (Exception e) {
session.disconnect();
e.printStackTrace();
}
...
请帮助我,谢谢你:)