|
13 | 13 | import javax.sound.sampled.Line; |
14 | 14 | import javax.sound.sampled.UnsupportedAudioFileException; |
15 | 15 |
|
16 | | -import javajs.api.ResettableStream; |
17 | 16 | import javajs.util.BC; |
18 | 17 | import javajs.util.Base64; |
19 | 18 | import javajs.util.OC; |
@@ -370,10 +369,9 @@ private static AudioFormat getAudioFormatForStreamOrBytes( |
370 | 369 |
|
371 | 370 | Map<String, Object> props = new Hashtable<String, Object>(); |
372 | 371 | String fmt = (stream == null ? getAudioTypeForBytes(header) : getAudioTypeForStream(stream)); |
373 | | - ResettableStream jsstream = (ResettableStream) stream; |
374 | 372 | props.put("fileFormat", fmt); |
375 | 373 | if (stream != null) |
376 | | - jsstream.resetStream(); |
| 374 | + stream.reset(); |
377 | 375 | Encoding encoding = null; |
378 | 376 | float sampleRate = -1; |
379 | 377 | int sampleSizeInBits = -1; |
@@ -423,23 +421,22 @@ private static AudioFormat getAudioFormatForStreamOrBytes( |
423 | 421 | } catch (Throwable e) { |
424 | 422 | } finally { |
425 | 423 | if (stream != null) |
426 | | - jsstream.resetStream(); |
| 424 | + stream.reset(); |
427 | 425 | } |
428 | 426 | return new AudioFormat(encoding, sampleRate, sampleSizeInBits, channels, |
429 | 427 | frameSize, frameRate, bigEndian, props); |
430 | 428 | } |
431 | 429 |
|
432 | 430 |
|
433 | 431 | private static String getAudioTypeForStream(ByteArrayInputStream stream) throws UnsupportedAudioFileException { |
434 | | - ResettableStream jsstream = (ResettableStream) (Object) stream; |
435 | | - jsstream.resetStream(); |
| 432 | + stream.reset(); |
436 | 433 | byte[] b = new byte[12]; |
437 | 434 | try { |
438 | 435 | stream.read(b); |
439 | 436 | } catch (IOException e) { |
440 | 437 | // no problem |
441 | 438 | } |
442 | | - jsstream.resetStream(); |
| 439 | + stream.reset(); |
443 | 440 | return getAudioTypeForBytes(b); |
444 | 441 | } |
445 | 442 |
|
|
0 commit comments