复制歌曲文件

import java.io.*;
class copymp3 
{
	public static void main(String[] args) 
	{
		BufferedInputStream bis = null;
		BufferedOutputStream bos = null;
		try
		{
			bis = new BufferedInputStream(new FileInputStream("d:\\喜欢你.mp3"));
			bos = new BufferedOutputStream(new FileOutputStream("d:\\喜欢你1.mp3"));
			int len = 0;
			
			while((len = bis.read())!=-1)
			{
				bos.write(len);
			}
		}
		catch (IOException e)
		{
			throw new RuntimeException("复制歌曲失败");
		}
		finally
		{
			try
			{
				if(bos!=null)
					bos.close();
			}
			catch (IOException e)
			{
				throw new RuntimeException("写入关闭失败");
			}
			try
			{
				if(bis!=null)
					bis.close();
			}
			catch (IOException e)
			{
				throw new RuntimeException("读取关闭失败");
			}
		}
	}
}

你可能感兴趣的:(复制歌曲文件)