java - 如何检查 FileObject 是否是文件夹?

标签 java apache-commons-vfs

我正在使用 Apache Commons VFS(虚拟文件系统)通过 SFTP 访问一些文件。有人知道如何检查 org.apache.commons.vfs.FileContent 的实例是否是文件夹吗?

最佳答案

如果您的意思是检查 FileObject ,那么你就可以使用 [ FileObject.getType() ]( http://commons.apache.org/vfs/apidocs/org/apache/commons/vfs/FileObject.html#getType() 。给定一个非空的 FileContent ,你总是会假设它来自一个文件。正如规范 here 所说:

There are two types of files: Folders, which contain other files, and normal files, which contain data, or content. A folder may not have any content, and a normal file cannot contain other files.

关于java - 如何检查 FileObject 是否是文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1120098/

相关文章:

java - Apache commons sftp - 转到用户主目录上方

vfs - Apache Commons VFS线程安全性和资源管理

java - 使用 Commons VFS 进行 Http 文件传输

与 apache vfs 的 SFTP 连接失败,但与 WinSCP 成功

java - 让 linearLayout 从屏幕上消失?

java - 如何使用Spring MVC在JSP上显示图像

java - Playframework - Eclipse 无法检测到新模板

java - 使用 Apache Commons VFS 中断 SFTP 复制

java - 当我尝试发布到我的 spring api 时 403 被禁止?

java - Amazon Gateway API 和 JAVA