首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Access >

使用RandomAccessFile发生固定大小文件

2013-11-02 
使用RandomAccessFile产生固定大小文件package ioimport java.io.FileNotFoundExceptionimport java.io.

使用RandomAccessFile产生固定大小文件
package io;import java.io.FileNotFoundException;import java.io.IOException;import java.io.RandomAccessFile;public class BigFileTester {public static void main(String[] args) throws FileNotFoundException, IOException {int cap = 3*1024*1024;long start2 = System.currentTimeMillis();RandomAccessFile r = new RandomAccessFile("C:\\test2.txt", "rw");r.setLength(cap);r.close();long duration2 = System.currentTimeMillis() - start2;System.out.println(duration2);}}

?

热点排行