复制文件
public class CopyMusic {
/*
* 以字节为单位读取文件,常用读取二进制文件,如图片、音乐、影像等
*/
public static void main(String[] args) {
byte[] tempByte = new byte[1024];
int byteread = 0;
try {
FileInputStream fis = new FileInputStream("c:\\music.wma");
FileOutputStream fos = new FileOutputStream("copy_music.wma");
while((byteread = fis.read(tempByte)) != -1){
fos.write(tempByte);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
回忆过去,珍惜现在,放眼未来

浙公网安备 33010602011771号