Skip to content

Instantly share code, notes, and snippets.

@gustavoapolinario
Created January 18, 2017 12:13
Show Gist options
  • Save gustavoapolinario/c4aa49b708231ded21af01d9b09e9f9c to your computer and use it in GitHub Desktop.
Save gustavoapolinario/c4aa49b708231ded21af01d9b09e9f9c to your computer and use it in GitHub Desktop.
Le arquivo no java
private String leArquivo(String nome) {
String linha = "";
StringBuilder conteudoArquivo = new StringBuilder();
try {
FileReader arq = new FileReader(nome);
BufferedReader lerArq = new BufferedReader(arq);
while (linha != null) {
linha = lerArq.readLine();
conteudoArquivo.append(linha);
}
arq.close();
} catch (IOException e) {
UtExceptionMaestro.logarException(Thread.currentThread(), e, LevelLog.ERROR);
}
return conteudoArquivo.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment