是否可以使用Java格式化记忆棒,笔式驱动器或磁盘? [英] Is it possible to format a memory stick, pen drive or disk using Java?
本文介绍了是否可以使用Java格式化记忆棒,笔式驱动器或磁盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个多plattform实用程序来格式化/擦除记忆棒,磁盘等。
是否可以在Java中执行此操作?或者是否需要为每个操作系统plattform调用本地方法?
解决方案这是非常具体的系统,没有通用的方法执行此操作。您的选择是
$ b
- 创建一个JNI库以使用系统调用执行此操作
- 编写一个包装类(例如,捕获标准输出并为外部进程提供输入到标准输入)
- 使用特定于操作系统的技术(如前所述)来清零设备 >
- 使用类似 fat32-lib 的方式来操作特定的文件系统类型。
I would like to create a multi-plattform utility to format / erase memory sticks, disks, etc.
Is it possible to do this in Java? Or do I need to call native methods for each operational system plattform?
解决方案
It is very system specific, there is no universal way to perform this. Your options are
- Create a JNI library to perform this using system calls
- Write a wrapper class around utilities that perform this operation (for example, capture stdout and give inputs to stdin for an external process)
- Use OS-specific techniques (as previously mentioned) to zero out devices
- Use something like fat32-lib to manipulate specific file system types.
这篇关于是否可以使用Java格式化记忆棒,笔式驱动器或磁盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文