package control;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by sebastian on 07.04.17.
 */
public class ReadIn {

    public static String read(String sourcePath) {


        String result = "";

        try {


            InputStream is = Main.class.getResourceAsStream(sourcePath);
            InputStreamReader isr = new InputStreamReader(is);
            BufferedReader bf = new BufferedReader(isr);
            List<String> lines = new ArrayList<>();

            while (true) {
                String l = bf.readLine();
                if (l == null) {
                    break;
                } else {
                    lines.add(l);
                }
            }
            for (String l2 : lines) {
                result = result.concat(l2 + "\n" );
            }
            return  result;


        } catch (Exception ex) {
            ex.printStackTrace();
        }
       return  result;

    }




}
