//copy picture
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream("/Users/denmeiho/Desktop/筆記/未命名文件.png");
fos = new FileOutputStream("/Users/denmeiho/Desktop/筆記/未命名文件1.png");
byte[] buf = new byte[1024*1024];
int len = 0;
try {
while ((len = fis.read(buf))!=-1) {
fos.write(buf, 0, len);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
try {
fis.close();
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//////////////////////////////
//通過字節(jié)流的緩沖區(qū)完成復(fù)制
static void copyMp3(){
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream("/Users/denmeiho/Desktop/其他/CSII項(xiàng)目/ShanDongNongxin0905喜子姐/JSZXYH/SDK/face_SDK/audio/動(dòng)作不規(guī)范.mp3");
bis = new BufferedInputStream(fis);
fos = new FileOutputStream("/Users/denmeiho/Desktop/xx.mp3");
bos = new BufferedOutputStream(fos);
byte[] buf = new byte[1024];
int by = 0;
try {
while((by = bis.read())!=-1){
bos.write(by);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
bis.close();
bos.close();
}
}