How to access specific raw data on disk from java

前端 未结 8 566
一向
一向 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:29

    Java can only access files. Unix has the concept of "raw devices" as files in the /dev directory, so what you want is possible there. But not on windows, because it has no such file representation of the raw HD data.

    0 讨论(0)
  • 2020-11-28 08:30

    @hunsricker : note that accessing raw devices require some privileges (depends on drive : removable or not / depends on file system for WinXP : iso9660 is allowed, FAT is not).

    Note also that size of read does matter (depending on OS) : On an iso9660 filesystem, read(1024 bytes) works on XP but fails on Seven. On Seven it look like the reads must be block aligned : read(2048 bytes) works.

    0 讨论(0)
提交回复
热议问题