Here you can find the source of readLine(RandomAccessFile wiki)
public static String readLine(RandomAccessFile wiki) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { private static final String NEWLINE = System.lineSeparator(); public static String readLine(RandomAccessFile wiki) throws IOException { long start = wiki.getFilePointer(); wiki.readLine();// w w w . j a va2 s. c o m long end = wiki.getFilePointer(); wiki.seek(start); byte[] b = new byte[(int) (end - start)]; wiki.read(b); return new String(b).replace(System.lineSeparator(), ""); } public static String read(String file) throws FileNotFoundException, IOException { try (BufferedReader br = new BufferedReader(new FileReader(file))) { return read(br); } } public static String read(BufferedReader br) throws IOException { StringBuffer sbuff = new StringBuffer(); String ln; while ((ln = br.readLine()) != null) sbuff.append(ln).append(NEWLINE); return sbuff.toString(); } }