private void le() { // limpa a area de log para que tenha apenas uma leitura do arquivo na tela if (!areaLog.getText().isEmpty()) { areaLog.setText(defaults.getEMPTY_STRING()); } // verifica a existencia do arquivo de log.. if (!f.exists()) { Utilitarios.getInstance().showErrorMessage("O Arquivo : " + f.getPath() + " Nao Existe!"); } else { try { RandomAccessFile raf = new RandomAccessFile(f, "rw"); // verifica se a dados a serem mostrados if (raf.length() == 0) { Utilitarios.getInstance().showInfoMessage("Arquivo de Log Vazio!"); raf.close(); } else { // preseguimos com a leitura.. String dados; try (BufferedReader in = new BufferedReader(new FileReader(f.getPath()))) { while ((dados = in.readLine()) != null) { areaLog.append(dados + "\n"); } } catch (IOException erro) { ExceptionManager.ThrowException("Erro: ", erro); } } } catch (IOException ex) { Logger.getLogger(FrameLog.class.getName()).log(Level.SEVERE, null, ex); } } }
private void limpa() { areaLog.setText(defaults.getEMPTY_STRING()); Utilitarios.getInstance().zeraArquivo(f); le(); }