Java声音演示 – 问题

我已经下载并在
http://java.sun.com/上运行
Java sound demo.当我运行捕获/回放示例时,我可以录制和回放我的声音.但是在我将声音保存到wav文件后,我无法播放它并收到错误,因为

Unable to reset the stream
java.io.IOException: mark/reset not supported

你能告诉我为什么吗?

非常感谢.

最佳答案 根据
this (very old) bug report

This bug is caused primarily by a
recent change in PushBackInputStream:
AudioInputStream used
PushBackInputStream internally in
order to cope with irregular frame
size reads of the underlying input
stream.

看起来问题是AudioInputStream不支持reset(),这导致了这个问题.建议的解决方法是使用java 1.4.1来运行演示.当然,我希望在主API中对此进行更改,因此当您自己开发时,使用Java 6进行此操作应该没有问题.

点赞