public List<T> getAllData() {

        FileInputStream inputStream = null;
        Scanner sc = null;
        final List<T> data = new ArrayList<T>();

        //make use of Scanner instead of directly reading the file content. This will avoid loading the whole file in memory
        try {
            inputStream = new FileInputStream(mSourceFile);
            sc = new Scanner(inputStream, "UTF-8");
            while (sc.hasNextLine()) {
                String line = sc.nextLine();
                data.add(dataFromString(line));
            }
            // note that Scanner suppresses exceptions
            if (sc.ioException() != null) {
                throw sc.ioException();
            }
            return data;
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (sc != null) {
                sc.close();
            }
        }
        return Collections.emptyList();
    }