
import java.util.*;
import java.io.*;

public class LoadProperties extends Properties {

    private String fileProperties;
    Properties app = new Properties();

    public LoadProperties (String nomeFileProperties) {

           fileProperties = nomeFileProperties;

           try {

               FileInputStream in = new FileInputStream(fileProperties);
               in = new FileInputStream(nomeFileProperties);
               app.load(in);
               in.close();

               } catch (FileNotFoundException e ) {
                 System.err.println("Erro: " + e.getMessage());

               } catch (IOException e ) {
                 System.err.println("Erro: " + e.getMessage());
 
           }
    }

    public String lineFeed () {

           char letra;
           String lineFeed;

           letra = 13;
           lineFeed = new Character(letra).toString();
           letra = 10;
           lineFeed += new Character(letra).toString();
           return lineFeed;

    }

    public String printProperties () {

           String printProperties = new String();
           Enumeration enumKey = app.propertyNames();
           while (enumKey.hasMoreElements()) {
                 String key = enumKey.nextElement().toString();
                 String value = app.getProperty(key);
                 printProperties += key + " ==> " + value + lineFeed();
           } 

           return printProperties;
   }
}