我对如何将Runnable块从此示例中翻译有点困惑:
http://www.codejava.net/coding/capture-and-record-sound-into-wav-file-with-java-sound-api
Thread stopper = new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(RECORD_TIME);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
recorder.finish();
}
});
我不确定的代码部分是这个:
Runnable(){... public void run() {... }}
InterruptedException
中打印printStackTrace()
... 至少,在catch块中应该使用Thread.currentThread().interrupt()
- fgeTimer
或ScheduledExecutorService
,应尽量避免使用基于Thread
的sleep()
方法!然而,这并不真正有助于翻译... - Boris the Spider