I am working with a large number of files and I need to know the each file physical offset (address) in the hard disk or flash memory
Thanks dear
I am working with a large number of files and I need to know the each file physical offset (address) in the hard disk or flash memory
Thanks dear
Files don't have one physical offset. Instead they are made up of blocks (unless your file is small in which case there is one block) You can read the raw file system on Linux if you are root, e.g /dev/sd1c but how you do this depends on the file system you have.
I suggest you read up the wikipedia page for the filesystem you are using.
However, it is more than likely you don't know the actual location and the virtual location is all you need. To do this you open the file with FileInputStream/FileOutputStream/RandomAccessFile and memory map the file. This will map the file into continuous virtual memory and you can access the contents of the file as if it were in memory (if you access the whole file there is a good chance it will be cached in memory)
Java cannot do this. The problem is too low-level. You would need to use a systems programming language.