问题
Hi i am using LibGDX to program android.
Is there some way to sraightforward access specific line on the file without going through all the lines and reading them until i reach desired line? (Can I just say I want to read line number so-and-so?)
I know there are such methods:
FileHandle file = Gdx.files.internal("list.txt");
BufferedReader reader = new BufferedReader(file.reader());
reader.readLine(); <--- but it reads only first line !
//// or using scanner
scanner1 = new Scanner(new File("list.txt"));
scanner1.nextLine(); <--- also reads first line ..
Can I do it without looping through unnecessary lines? Any solutions, workarounds welcome. Thanx
来源:https://stackoverflow.com/questions/28940276/is-there-way-access-specific-line-in-file-without-looping-java-libgdx