-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
1.2.0
-
x86
-
windows_95
Name: ccC48265 Date: 01/25/98
Applet.newAudioClip() is neat! However if you give a bogus URL, you get no error
indication.
Perhaps it should throw an IOException, or at least return null and make you
check it.
The following example will demonstrate this problem.
See the comment at the end about the System.exit(0) statement.
import java.applet.*;
import java.net.*;
public class P {
static String defSounds[] = {
"file:///windows/media/chord.wav",
"file:///windows/media/Beethoven's Fur Elise.rmi",
};
public static void main(String av[]) {
if (av.length == 0)
main(defSounds);
else for (int i=0;i<av.length; i++) {
System.out.println("Starting " + av[i]);
try {
URL snd = new URL(av[i]);
// open to see if works or throws exception,
close to free fd's
snd.openConnection().getInputStream().close();
Applet.newAudioClip(snd).play();
} catch (Exception e) {
System.err.println(e);
}
}
// With this call, program exits before/during play.
// Without it, program hangs forever after play.
// System.exit(0);
}
}
(Review ID: 23851)
======================================================================
kara.kytle@Eng 1998-01-26