日期:2014-05-20 浏览次数:20628 次
File file1 = new File("D:\\dvd.avi"); InputStream dvdinput = new FileInputStream(file1); InputStream in = new BufferedInputStream( dvdinput ); File file2 = new File("D:\\dvd1.avi"); OutputStream outputStream = new FileOutputStream( file2 ); OutputStream outputbuffer = new BufferedOutputStream( outputStream, 512 ); System.out.println(in.available()); if( !file2.exists() ){ file2.createNewFile(); } byte b[] = new byte[ in.available() ]; int len= -1; while( (len=in.read(b)) != -1 ){ // 这里你弄错了! outputbuffer.write(b,0,len); // 这里读完了,马上写入到新文件 } outputbuffer.flush(); outputbuffer.close(); in.close();