此代码不起作用。我上了一个类,因为可以找到here,但是音乐不起作用。我怎样才能解决这个问题?
private void lblCliqueMouseClicked(java.awt.event.MouseEvent evt){
lblClique.setText("achou");
musica = new Som();
boolean repetir = false;
FileInputStream arquivo = null;
try {
arquivo = new FileInputStream("musica.mp3");
} catch (FileNotFoundException ex) {
Logger.getLogger(TelaProjeto.class.getName()).log(Level.SEVERE, null, ex);
}
musica.tocar(arquivo, repetir);
}
最佳答案
错误标记/重置不支持表示您提供的输入流不支持设置标记并将流重置为该标记。为此,只需将FileInputStream包装在BufferedInputStream中(请参阅http://docs.oracle.com/javase/7/docs/api/java/io/BufferedInputStream.html)
InputStream arquivo=null;
...
arquivo=new BufferedInputStream(new FileInputStream(...));