I am using BufferReader to read log files from a game server. It does work but it just doesn't read the entire file just a small portion of it.
My code:
public ArrayList<String> readFile(File file){
try (BufferedReader br = new BufferedReader(new FileReader(file.getAbsolutePath())))
{
String sCurrentLine;
ArrayList<String> list = new ArrayList<String>();
while ((sCurrentLine = br.readLine()) != null) {
list.add(sCurrentLine);
}
return list;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
The files that i try to read have the size between 0.5 MB - 1.5 MB. The server logs look like this but it has many more lines. Like 20000 lines. I am only getting like 1500 lines from it.
00:05:29 - Great_Zhupan_Uros_SRB <img=ico_spear> Wolfpack_SikiciArthasan
00:05:32 - Teamhit: AE_Shemaforash hit AB_Artorius for 10 hp.
00:05:32 - AE_Shemaforash <img=ico_axeone> AB_Artorius
00:05:32 - AE_Shemaforash(20578) teamkilled AB_Artorius(1076080).
00:05:41 - Great_Zhupan_Uros_SRB <img=ico_spear> IR_Fall3N~3nG3l
00:05:46 - AE_Shemaforash <img=ico_axeone> Xodanrot
00:06:05 - *DEAD* [AE_Blivandefar] xxxxxxxxxxxxxxxx
00:06:05 - Wolfpack_Dennell has joined the game with ID: 1305305
00:06:07 - Wolfpack_Dennell joined the server.
The log file starts at time 00:00:00 and ends at 23:59:59. When i start reading it, it only reads a small part of it like from 22:08:00 to 23:59:59. Can someone tell me what i am doing wrong? And if there are better solutions for this then i am all ears. Im using this data to convert them into statistics for players.