Name: krC82822 Date: 08/07/2001
orig synopsis: "AudioSystem.getAudioFileFormat(InputStream) broken"
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
The javax.sound.sampled.AudioSystem.getAudioFileFormat() call works differently
for a URL (it works) than for an InputStream (it does not work).
The following program prints out:
WAVE (.wav) file, byte length: 23252, data format: PCM_SIGNED, 44100.0 Hz, 16
bit, mono, little-endian, audio data
WAVE (.wav) file, byte length: 23252, data format: PCM_SIGNED, -1.0 Hz, -1 bit,
mono, audio data
This looks like a bug to me, because they should be reading the same data!
>>>>>cut here<<<<<<
import javax.sound.sampled.*;
import java.net.*;
public class BadSound
{
public static void main(String args[])
throws Exception
{
URL url = BadSound.class.getResource(args[0]);
AudioFileFormat aff1 = AudioSystem.getAudioFileFormat(url);
AudioFileFormat aff2 =
AudioSystem.getAudioFileFormat(url.openStream());
System.out.println(aff1);
System.out.println(aff2);
}
}
(Review ID: 129385)
======================================================================
|