问题
This code does not work. I took a class ready since it can be found here, but the music does not work. How can I fix this?
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);
}
回答1:
The error mark/reset not supported means the input stream you provided does not support setting a mark and resetting the stream to that mark. To achieve this, just wrap your FileInputStream inside a BufferedInputStream (see http://docs.oracle.com/javase/7/docs/api/java/io/BufferedInputStream.html)
InputStream arquivo=null;
...
arquivo=new BufferedInputStream(new FileInputStream(...));
来源:https://stackoverflow.com/questions/29776564/java-io-ioexception-mark-reset-not-supported