我已经下载并运行了 Java sound demo可用 http://java.sun.com/ .当我运行捕获/回放示例时,我可以录制和回放我的声音。但是在我将语音保存到 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 应该没有问题。
关于Java 声音演示 - 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5376224/