zoukankan      html  css  js  c++  java
  • [转]html5音乐播放器

    http://files.cnblogs.com/files/xjyggd/html5music.rar

    import java.io.File;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Map;

    public class directoryTest {
    private static ArrayList<String> filelist = new ArrayList<String>();

    private static Map<String, String> fileMap = new HashMap<String, String>();

    public static void main(String[] args) throws Exception {
    String filePath = "G://music//mp3";
    getFiles(filePath, "mp3");

    StringBuilder stringBuilder = new StringBuilder();

    for(String strFile : filelist)
    {
    String[] strFileSplit = strFile.split("\\");
    String strFileName = strFileSplit[strFileSplit.length-1];
    System.out.println(strFileName);
    if(stringBuilder.length() > 0)
    {
    stringBuilder.append(",");
    }
    stringBuilder.append("{name:'" + strFileName + "',author:'',url:'" + strFile.replace("\","\\") + "'}");
    }
    System.out.println(stringBuilder.toString());
    }
    /*
    * 通过递归得到某一路径下所有的目录及其文件
    */
    static void getFiles(String filePath, String pattern){
    File root = new File(filePath);
    File[] files = root.listFiles();
    for(File file:files){
    if(file.isDirectory()){
    /*
    * 递归调用
    */
    getFiles(file.getAbsolutePath(), pattern);
    //filelist.add(file.getAbsolutePath());
    //System.out.println("显示"+filePath+"下所有子目录及其文件"+file.getAbsolutePath());
    }
    else
    {
    // System.out.println("显示"+filePath+"下所有子目录"+file.getAbsolutePath());
    if (file.getName().contains(pattern))
    {
    //fileMap.put(file.getName(), file.getAbsolutePath());
    filelist.add(file.getAbsolutePath());
    // System.out.println(file.getName() + " " + file.getAbsolutePath());
    }
    }
    }
    }
    }

  • 相关阅读:
    区块链入门
    上海美食餐厅
    《OD学hadoop》20160910某旅游网项目实战
    《OD学hadoop》20160904某旅游网项目实战
    《OD学hadoop》20160903某旅游网项目实战
    qt5-自定义类
    qt5-Qt Creator使用
    qt5-QPushButton按钮
    qt5-工程文件的介绍--快捷键
    电路分析-电阻
  • 原文地址:https://www.cnblogs.com/xjyggd/p/4495911.html
Copyright © 2011-2022 走看看