exception - java.io.IOException: Stream closed? I didn't close anyting -


i exception , don't know why, since didn't close streams. wrapped wav files in bufferedinputstream can call input.reset() after playing sounds, way can play them more once using clip.start(). stream getting closed?

public static void init() {     string path = "res/sfx/";      inputstream audiosrc;     inputstream bufferedin;      try {         audiosrc = sound.class.getclassloader().getresourceasstream(path + "select.wav");         bufferedin = new bufferedinputstream(audiosrc);         select = audiosystem.getaudioinputstream(bufferedin);//exception thrown here          audiosrc = sound.class.getclassloader().getresourceasstream(path + "hiping.wav");         bufferedin = new bufferedinputstream(audiosrc);         hiping = audiosystem.getaudioinputstream(bufferedin);          audiosrc = sound.class.getclassloader().getresourceasstream(path + "loping.wav");         bufferedin = new bufferedinputstream(audiosrc);         loping = audiosystem.getaudioinputstream(bufferedin);          audiosrc = sound.class.getclassloader().getresourceasstream(path + "explode.wav");         bufferedin = new bufferedinputstream(audiosrc);         explode = audiosystem.getaudioinputstream(bufferedin);     } catch (exception e) {         e.printstacktrace();     } } 

the rest of exception message is:

at java.io.bufferedinputstream.getinifopen(unknown source) @ java.io.bufferedinputstream.fill(unknown source) @ java.io.bufferedinputstream.read(unknown source) @ com.sun.media.sound.riffreader.read(unknown source) @ com.sun.media.sound.riffreader.<init>(unknown source) @ com.sun.media.sound.wavefloatfilereader.internal_getaudiofileformat(unknown source) @ com.sun.media.sound.wavefloatfilereader.getaudiofileformat(unknown source) @ com.sun.media.sound.wavefloatfilereader.getaudioinputstream(unknown source) @ javax.sound.sampled.audiosystem.getaudioinputstream(unknown source) 


Comments