Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package runners.pkg16;
  7.  
  8. import java.io.File;
  9. import java.io.FileNotFoundException;
  10. import java.util.Formatter;
  11. import java.util.Scanner;
  12. /**
  13.  *
  14.  * @author VitorPacheco
  15.  */
  16. public class LogErros {
  17.    
  18.     static Formatter criarFicheiroLogErros (String nomeFile) throws FileNotFoundException{
  19.         Formatter out = new Formatter(new File(nomeFile));
  20.        
  21.         return out;
  22.     }
  23.    
  24.     public static void registoErro(String linha, String erro, Formatter LogErros){
  25.        
  26.                 LogErros.format("%50s %40s\n", linha, erro);      
  27.        
  28.     }
  29.    
  30.     static void fecharFicheiroLogErros (Formatter nomeFile) throws FileNotFoundException{
  31.         nomeFile.close();
  32.     }
  33.    
  34.     public static void lerInfoFicheiroLogErros(Scanner file){
  35.         while (file.hasNext()){
  36.             String linha = file.nextLine();
  37.             System.out.printf("%s\n", linha);
  38.         }
  39.        
  40.    
  41. }
  42.    
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement