Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Richard Noneya

Greenhorn
+ Follow
since Oct 18, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Richard Noneya

S Chan wrote:Hi all, I wonder if it is possible for Java to access Hard disk clusters?

Let's say I want to write a file rescue program with Java. Normal deleting operation by OS is to just remove the pointer of the file, so the file is "lost" in the large sea of hard disk clusters. The actual file still exists in the hard disk if it is not overwritten or corrupted later on. If I want to write an application in Java so that the application can scan the hard disk clusters to find the deleted file back, how can I do that?

Similarly, if I want to write the application so that it hard deletes a deleted file, i.e. overwriting data over the deleted file at the exact hard disk clusters, is that possible?

Also another example, when Java creates a large file on the hard disk, can I make sure the file is written on continuous clusters on the hard disk (if space available)?



I guess you could open that file for writing and write raw bits, but i don't think that would guarantee that the new file would be written to the same location on the drive, as the index may just be re-referenced. A few years ago I wrote a program in java that 'zeroed' entire hard drives, only I did it with random bits instead of only zeros, so the zeroing process would not be detected but the information was equally nonsense, and I did it by writing 1 Mb files until the hard drive was full then full delete them at the end, it worked. I thought perhaps that might be helpful to you.
9 years ago