I am using the ogg decoder from Tor-Einar Jarnbjo and have no problem when setting things up to read from a file. When I try and load the file into memory as a byte array and then use the decoder, I get an exception.
physOggStream = new FileStream(new RandomAccessFile(fileName, "r"));
FileInputStream fileInputStream = new FileInputStream(sourceFile);
audioSamples = new byte[(int)sourceFile.length()];
ByteArrayInputStream baInputStream = new ByteArrayInputStream(audioSamples);
physOggStream = new BasicStream(baInputStream);
los = (LogicalOggStream) physOggStream.getLogicalStreams().iterator().next();
vs = new VorbisStream(los);
You can see by the comments which version is which. The one line file reading works fine with the last two lines of code. If I use the byte array, the new VorbisStream() throws an index out of bounds exception. I get an error about the header being wrong before that.
Can someone point me to what I'm doing wrong?