ptoye wrote:I expect the problem is the Java 7 JRE. Why not raise a bug report and see what Oracle has to say on the matter?
I have a program which works fine under Java 6. But under Java 7 it fails when calling getAudioInputStream. The failure is an I/O exception saying that Mark/Reset is not available for the stream (which is true under both Javas 6 & 7).
Has getAudioInputStream changed between Java versions?
And how to mend the program? ..One potential fix is to read the input stream and write the bytes into a <tt>ByteArrayOutputStream</tt>, when they are loaded, call <tt>getBytes()</tt> and use that to construct a <tt>ByteArrayInputStream</tt>. Use the BAIS for <tt>getAudioInputStream(InputStream)</tt>. The BAIS is definitely positionable.
This syntax uses InputStream as an argument, and InputStream requires that a stream be "markable". Maybe this was a "grey area" and previously worked but with Java 7 is now more rigorously enforced?
AudioInputStream ais = AudioSystem.getAudioInputStream(AudioMixer.class.getResourceAsStream(fileName));
I haven't been able to verify if this works yet!
URL url = AudioMixer.class.getResource(fileName); AudioInputStream ais = AudioSystem.getAudioInputStream(url);