I have been trying to write an Audio CD ripper in Java so I can learn how they work. I can't seem to figure out how to actually read the songs off CD drive. I have managed to open the .cda files but there not very useful unless I can access the sectors on the CD. I've tried to open the D: drive (which is the CD drive on my computer) using the code below, but it gives File Not Found errors. I'm guessing this is because the CD drive is not a file. Is there any other type of Input Stream or is there a different way I can read from the CD drive. I've been searching for a long time and there is nothing that I can find that would help.
public class learning
{
public static void main(String[] args) throws IOException
{
FileInputStream input = new FileInputStream( "D:\\" );
}
}
The specific error message is :
Exception in thread "main" java.io.FileNotFoundException: D:\ (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at learning.main(learning.java:5)
Cheers Daniel
There is an OS project for this: Ripper.
The magic is in the GrabEncodePanel.java, in the
getCDDADir()
andgetCDDAStream()
functions (I'm afraid to post the actual source, as then I'd have to post the license too...)EDIT I learnt something today too: this is only straightforward on Linux according to this FAQ