BufferedReader vs. RandomAccessFile in java
bufferedreader, file, file-io, java, readline
Solution
RandomAccessFile.readLine() might be slightly faster because it ignores character encoding. However it doesn't use buffering and still use StringBuffer :P so it could be slower on your system.
BufferedReader.readLine() is preferred because it handles character encoding e.g. UTF-8 or Windows-1252.
There is also a DataInputStream.readLine() which can be used with BufferedInputStream. Only use this is you can be sure you want ISO-8859-1 or ASCII encoding.
Problem
I'm writing a small application in java I read text files in various sizes and I need to read them line by line (and insert the line into array). Is there difference between `BufferedReader.ReadLine()` and `RandomAccessFile.ReadLine()`, in terms of performance? Is there any reason to prefer one or the other?