Вопрос

If I were to attach a FileInputStream to, say, /dev/hda1 and .read() a number of bytes, would this effectively read raw disk sectors?

Understand that I'm not interested in interpreting the data in the context of a filesystem, and I do not want to just duplicate it.

I want to read raw disk sectors and get the actual data as it resides on disk.

My reason is this - as a curiosity, I'm considering writing a cluster analysis pattern recognition program to analyze raw disk data.

Это было полезно?

Решение

Yes it will. A Path (or File with the old API) is just an abstract path. You can create Paths.get("I don't exist") (or new File("I don't exist") with the old API).

Since this is Unix, you can open("/dev/hda1"), hence you get a file descriptor with read() and write() (but don't) on it.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top