文件分割

import java.io.File;
import java.io.RandomAccessFile;
 
public class SplitFile {
       public static void main(String[] args) throws Exception {
            File src = new File("D:/javac/2.txt" );
            RandomAccessFile rf = new RandomAccessFile(src,"r" );
            rf.seek(10); //跳跃多少个字节
            
             byte[] flush = new  byte[512];
             int len = 0;
             while(-1!=(len=rf.read(flush))) {
                  String s = new String(flush,0,len);
                  System. out.println(s);
            }
            rf.close();
            
      }
}
posted @ 2015-04-03 12:31  王八一瓶子  阅读(165)  评论(0)    收藏  举报