作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
给定一个 FileDescriptor
对象,是否可以通过某种方式从中创建一个 File
?
谢谢!
最佳答案
不容易,如果有的话。来自documentation :
Instances of the file descriptor class serve as an opaque handle to the underlying machine-specific structure
IFF 您的程序将仅在特定操作系统上运行,您可能会从 FileDescriptor
中的私有(private) fd
字段中提取信息。
例如,在 Linux 上,您可以将其与进程 ID 一起使用以访问 /proc/PID/fd
目录(或编写 JNI 以直接访问该信息)。
也就是说,当然不能移植到其他操作系统。在其他系统上可能会也可能不会做同样的事情。
关于java - 如何从 FileDescriptor 创建文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18383768/
我是一名优秀的程序员,十分优秀!