public static void main(String[] args) throws IOException {
BufferedInputStream bis = new BufferedInputStream(new FileInputStream("D:\\test\\001.mp4"));
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("D:\\test\\11\\002.mp4"));
//方法一:一次读取一个字节数据
int leng;
while ((leng=bis.read())!=-1){
System.out.println((char)leng);
bos.write(leng);
}
//方法二:一次读取一个字节数组 (推荐)
byte[] bytes = new byte[1024];
int len;
while ((len=bis.read(bytes))!=-1){
System.out.println(new String(bytes,0,len));
bos.write(bytes,0,len);
}
bis.close();
bos.close();
}