How to work programmatically with MBR and sectors of USB flash?

395 views Asked by At

I develop application and write in Java. My application needs access to MBR of USB flash and to content of its sectors. I thought about using JNI: call methods in Java, their implementation is in C++, use only standard C functions, no WinAPI, no Linux API.

And I don't know about possibility of working with such devices in Java without C++.

Tell me please the best way.

1

There are 1 answers

2
David Ehrmann On BEST ANSWER

If you're on *nix, you can just access /dev/sda directly. You'll probably want to use a FileChannel to read and write at arbitrary offsets. Windows is a different story.