I have been trying to write a simple audio ripper that i can use to learn how diffrent CODEC's work but i have got stuck on the first step, i cant get my program to read from the CD, the folowing code is what i have been trying to use
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Scanner;
public class learning
{
public static void main(String[] args) throws IOException
{
File cd = new File( "/dev/sr0" );
RandomAccessFile rawAccess = new RandomAccessFile( cd, "r" );
byte[] content = new byte[20];
rawAccess.seek(19613);
rawAccess.readFully(content);
System.out.println(content);
}
}
but it gives me the folowing error
Exception in thread "main" java.io.IOException: Input/output error
at java.io.RandomAccessFile.readBytes(Native Method)
at java.io.RandomAccessFile.read(RandomAccessFile.java:355)
at java.io.RandomAccessFile.readFully(RandomAccessFile.java:414)
at java.io.RandomAccessFile.readFully(RandomAccessFile.java:394)
at learning.main(learning.java:21)
and i cant figure out why i get this, i though maby RandomFileAccess wasn't the right class to use but the only thing i could find said this should work
Any help on how to read CD's from java would be much appreciated.
Cheers Daniel