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

发布于 2024-07-26 19:02:56 字数 110 浏览 3 评论 0原文

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

I'm using Apache Commons VFS (Virtual File System) to access some files over SFTP. Does anybody know how to check if an instance of org.apache.commons.vfs.FileContent is folder?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花辞树 2024-08-02 19:02:56

如果您的意思是检查 FileObject,那么您可以使用 [FileObject.getType()](http://commons.apache.org/vfs/apidocs/org/apache/commons/vfs/FileObject.html#getType ()。给定一个非空的 FileContent,您将始终假设它来自文件此处 说:

有两种类型的文件:包含其他文件的文件夹和包含数据或内容的普通文件。 文件夹中可能没有任何内容,普通文件不能包含其他文件。

If you mean checking FileObject, then you can use [FileObject.getType()](http://commons.apache.org/vfs/apidocs/org/apache/commons/vfs/FileObject.html#getType(). Given a non-empty FileContent, you would always assume it's coming from a file. As the specification here says:

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文