Java read from a specific volume address

60 Views Asked by At

I have to read some bytes from a specific address of a volume of external memory card.

I do not have a file to read but a drive address, how can I read with Java? I'm used to read by file path, I never read from a volume address...

1

There are 1 best solutions below

0
Tobia On

This is the solution:

File diskRoot = new File ("\\\\.\\PhysicalDrive0");
RandomAccessFile diskAccess = new RandomAccessFile (diskRoot, "r");
byte[] content = new byte[1024];
diskAccess.readFully(content);

However it needs to be run as Administrator.