• Advertisement
Sign in to follow this  

[java] getting an input stream from a disc

This topic is 4497 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well, I need to make an iso out of a disc. I haven't found any program who does this, so I decided to write my own in JAVA. I belive that if I can get an input stream from my cd drive, all I need to do is to write it into a file. So: 1)am I right, or am I just a dumb noob who knows nothing from his life and don't deserve to program? 2)how do I get an input stream from a cd drive?

Share this post


Link to post
Share on other sites
Advertisement
First, the language is called "Java". Its a name, not an acronym for anything.

Second, there is no way I'm aware of that would get you the input stream for a whole drive (or even only a directory). The standard C/C++ file functions can't do it either. You might be more lucky with the standard Windows API functions, though I doubt you will be lucky there to the extent that you need it.

What you can do without any problem is iterating through all files and subdirectories from a specified source directory (which might of course be the root of your CD drive) and get streams to the single files in there. While you could of course open the single files and stream them one after another into your ISO file (I'm working under the assumption that you know how an ISO file works in here), this is probably not what you want, unless your only aim is to avoid having n+1 files lying around on your HDD.

Getting real ISO data would be more problematic though. Windows has an API for working with CD/DVD burners. I never worked with it, but I would guess it could also be used to retrieve the required information for an ISO from a file. I highly doubt this would have a Java binding in the standard library though. Someone might have written one but the question is if it is worth the buffer to go through Java if you just need a simple read here, write over there.

Even a simple, ripped off Nero (or any other burner software) that comes with a CD burner will probably have ISO creation abilities though.

Share this post


Link to post
Share on other sites
It depends; what OS are you using? In linux you can just use something like 'dd if=/dev/cdrom of=cd.iso'. It would probably have to be done programmatically in windows, but I'm not sure how you would access the raw data in that situation.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement