读取文件中的音乐名,合并音乐(MP3)

来源:互联网 发布:中文域名在线转码 编辑:程序博客网 时间:2024/05/17 08:30

package Three;

import java.io.*;

public class MergeFile {
public static void main(String args[])
{
FileOutputStream fos=null;
FileInputStream fis=null;
String fileNames[]=new String[2];
File file=new File(“F:\mp3.list”);
String line=null;
String po=null;
String tmp[]=new String[2];
int a=0;
int j=0;
int l=0;
byte by[]=new byte[1024*8];//8K
try
{
fos=new FileOutputStream(“F:\合并.mp3”);
BufferedReader br = new BufferedReader(new FileReader(file));
while((line = br.readLine())!= null){ //一次读取一行
fileNames[j++]=line.replace(“./”,”“);
}
for(int i=0;i<2;i++)
{
fis=new FileInputStream(new File(“F:\”+fileNames[i]));

            while((a=fis.read(by))!=-1)            {                fos.write(by,0,a);            }        }    }    catch(FileNotFoundException e)    {        e.printStackTrace();    }    catch(IOException e)    {        e.printStackTrace();    }    finally    {        try        {            fis.close();            fos.close();        }        catch(IOException e)        {            e.printStackTrace();        }    }}

}

0 0
原创粉丝点击