How to access specific raw data on disk from java

前端 未结 8 603
一向
一向 2020-11-28 07:59

I\'m trying to use the following code to access one byte with offset of 50 bytes in a raw disk.

randomAccessFile = new RandomAccessFile(\"C:\", \"r\");
rando         


        
8条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 08:24

    In unix, you may read/write from /dev files. (I'm not sure)

    In Windows, I think you need to read/write disk sectors via JNI(Java Native Interface). Calls some C library to talk to the OS.

    update: In C library, you may need to use Win32API to get the file handle for example CreateFile(..) function.

    https://metacpan.org/pod/Win32API::File

    http://jan.newmarch.name/ssw/files/win32.html

提交回复
热议问题