Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Reading raw data

 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic