测试大文件_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > 测试大文件

测试大文件

 2014/4/24 18:31:54  race_liu  程序员俱乐部  我要评论(0)
  • 摘要:importjava.io.FileNotFoundException;importjava.io.IOException;importjava.io.RandomAccessFile;publicclassBigFileTester{/***@paramargs*@throwsIOException*/publicstaticvoidmain(String[]args)throwsIOException{//TODOAuto
  • 标签:文件 测试
class="java">import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;

public class BigFileTester {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		int cap = 4 * 1024 * 1024;
		long start = System.currentTimeMillis();
		RandomAccessFile r = new RandomAccessFile("D:\\test.txt", "rw");
		r.setLength(cap);
		r.close();
		long duration = System.currentTimeMillis() - start;

		System.out.println(duration + " ms");
	}

}
发表评论
用户名: 匿名