67,513
社区成员
发帖
与我相关
我的任务
分享
import java.io.*;
public class RandomAccessFileDemo {
public static void main(String[] args) throws Exception {
RandomAccessFile file = new RandomAccessFile("D:\\TMARC.tm", "rw");
file.seek(25497885);// 把文件指针位置设置到文件起始处
RandomAccessFile fileCopy=new RandomAccessFile("D:\\TMARC.gz","rw");
int len=87611;//取得文件长度(字节数)
byte[] b=new byte[len];
file.readFully(b);
fileCopy.write(b);
System.out.println("复制完成!");
}
}