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();