• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading raw data

 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you all know, Java I/O reads from files (streams) etc. I was wondering, is it possible for Java to read raw disk? I.E. Ghost, or image cloning. That means somehow Java code needs to access the harddrive blocks. Anyone have any suggestions?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On a UNIX-like system, I imagine you could do this easily by reading the device files directly -- i.e., /dev/hda to read the disk itself, or /dev/hda1 to read the first partition, etc.
Don't know enough about Windows, but I don't think it offers this abstraction.
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I know I can do that on *nix, I was actually looking on window for the same type of deal. I don't think it's possible, except a friend of mine told me he seems something did that without JNI? I really question that fact. That's why I ask everyone here.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, with JNI, you could call whatever Windows methods are available to get raw disk access. Don't know what those are, but I'm sure they're there. They just don't look like a file interface.
 
Dmitry Melnik
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On Windows you can open a volume/device as well. I'm not sure if Java security allows it though. Try open a file with name like \\.\C:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/createfile.asp
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!