java BufferedReader 定位读取文件内容。
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test {
/**
* @param args
*/
public static void main(String[] args) throws IOException {
long t1 = System.currentTimeMillis();
File f = new File(“F://LoginAction.java”);
InputStreamReader reader = new InputStreamReader(new FileInputStream(f),”UTF-8″);
BufferedReader bf = new BufferedReader(reader);
int i = 0 ;
String line = “”;
while (( line = bf.readLine())!=null) {
++i;
if(i==7923){
System.out.println(line);
break;
}
}
bf.close();
reader.close();
long t2 = System.currentTimeMillis();
System.out.println(“读取用时:”+(t2-t1)+”毫秒”);
}
}