DataOutput 中一坑

 RandomAccessFile randomAccessFile = null;dom

 randomAccessFile = new RandomAccessFile(file, "rw");spa

 byte buf[] = new byte[1024];it

                int len = -1;file

                while ((len = in.read(buf)) > -1) {文件

   /*                  randomAccessFile.write(buf);   while

    此处至关于randomAccessFile(buf,0,1024);new

    若是实际每次没有读入1024个字节,将多写入多余的字节,形成文件拷贝不许确

  */

              randomAccessFile.write(buf,0,len);

                }

                randomAccessFile.close();

相关文章
相关标签/搜索