java读大文件最快性能【转】
java读大文件最快性能
完全引用自: 几种读大文件方法的效率对比测试
据说1.88g只要5秒左右,未亲测.
/** * 读大文件 * BufferedReader + char[] * @throws IOException */ public static void readFile1() throws IOException{ long start = System.currentTimeMillis(); BufferedReader br = new BufferedReader(new FileReader(filePathName)); char[] buff = new char[1024]; int len = -1; while( (len = br.read(buff)) != -1 ){ //System.out.print(new String(buff, 0, len)); } long end = System.currentTimeMillis(); System.out.println("读大文件 BufferedReader + char[], 耗时="+(end-start)); }
感觉空虚寂寞,只是因为你无所关注,无处付出。