是否可以使用 Java 格式化记忆棒、笔式驱动器或磁盘?

发布于 2024-10-03 06:31:44 字数 1435 浏览 0 评论 0原文

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

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

发布评论

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

评论(3

沉溺在你眼里的海 2024-10-10 06:31:44

这是非常特定于系统的,没有通用的方法来执行此操作。您的选择是

  1. 创建一个 JNI 库以使用系统调用来执行此
  2. 操作 围绕执行此操作的实用程序编写一个包装类(例如,捕获 stdout 并向外部进程的 stdin 提供输入)
  3. 使用特定于操作系统的技术(如前所述)来执行此操作将设备清零
  4. 使用诸如 fat32-lib 之类的东西来操作特定的文件系统类型。

It is very system specific, there is no universal way to perform this. Your options are

  1. Create a JNI library to perform this using system calls
  2. Write a wrapper class around utilities that perform this operation (for example, capture stdout and give inputs to stdin for an external process)
  3. Use OS-specific techniques (as previously mentioned) to zero out devices
  4. Use something like fat32-lib to manipulate specific file system types.
一枫情书 2024-10-10 06:31:44

不直接。您将需要调用操作系统特定的程序来为您完成实际工作。

Not directly. You will need to invoke a operating system specific program to do the actual work for you.

抽个烟儿 2024-10-10 06:31:44

在类 Unix 系统上,您能够(最有可能仅以 root 身份)读取磁盘文件 /dev/{h,s}d* 并写入您想要的任何字节序列,包括代表 ext3 文件系统的字节序列。

不过,我不知道 Java 中有任何 ext3 库,所以你可能必须自己编写它。或者您关心的文件格式的库。

不过,这可能不是您想要的,但您可以接受:-)

On unix-like systems, you'd be able (only as root, most likely) to read the disk files /dev/{h,s}d* and write whatever byte sequence you want to them, including byte sequences that represent a, say, ext3 file system.

I don't know of any ext3 libraries in Java, though, so you might have to write it yourself. Or a library for the file format you care about.

This is probably not what you want, though, but you can settle for it :-)

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