java mp3 播放器
package com.stevezong.mp3palyer;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player;
public class Palyer {
public static void main(String[] args) {
try {
File file = new File("d:/music");
File[] files = file.listFiles();
for(File sub:files){
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(sub));
Player player =new Player(bis);
player.play();
player.close();
}
} catch (JavaLayerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
相关文章