Skip to content

Instantly share code, notes, and snippets.

@ckob
Created April 13, 2016 15:18
Show Gist options
  • Save ckob/907c7d474b3e7eec2e581d6952ac555d to your computer and use it in GitHub Desktop.
Save ckob/907c7d474b3e7eec2e581d6952ac555d to your computer and use it in GitHub Desktop.
public BookTxt(String filePath) {
this.filePath = filePath;
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(this.filePath));
strFitxer = new ArrayList<>(5000); // 5k de linies inicials, falta buscar quantes serien més aproximadament a partir del tamany del fitxer.
String actualLine;
while ((actualLine = br.readLine()) != null) {
strFitxer.add(actualLine);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (br != null)
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment